diff options
Diffstat (limited to 'tools/afcclient.c')
| -rw-r--r-- | tools/afcclient.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/tools/afcclient.c b/tools/afcclient.c index 2667e52..e71aea4 100644 --- a/tools/afcclient.c +++ b/tools/afcclient.c | |||
| @@ -332,7 +332,9 @@ static char* get_realpath(const char* path) | |||
| 332 | 332 | ||
| 333 | for (int i = 0; i < c_count; i++) { | 333 | for (int i = 0; i < c_count; i++) { |
| 334 | if (!strcmp(comps[i].str, "..")) { | 334 | if (!strcmp(comps[i].str, "..")) { |
| 335 | o--; | 335 | if (o > 1) { |
| 336 | o--; | ||
| 337 | } | ||
| 336 | continue; | 338 | continue; |
| 337 | } else if (!strcmp(comps[i].str, ".")) { | 339 | } else if (!strcmp(comps[i].str, ".")) { |
| 338 | continue; | 340 | continue; |
| @@ -1202,8 +1204,10 @@ static void handle_cd(afc_client_t afc, int argc, char** argv) | |||
| 1202 | } | 1204 | } |
| 1203 | if (p == curdir) { | 1205 | if (p == curdir) { |
| 1204 | *(p+1) = '\0'; | 1206 | *(p+1) = '\0'; |
| 1207 | curdir_len = 1; | ||
| 1205 | } else { | 1208 | } else { |
| 1206 | *p = '\0'; | 1209 | *p = '\0'; |
| 1210 | curdir_len = strlen(curdir); | ||
| 1207 | } | 1211 | } |
| 1208 | return; | 1212 | return; |
| 1209 | } | 1213 | } |
| @@ -1227,7 +1231,6 @@ static void handle_cd(afc_client_t afc, int argc, char** argv) | |||
| 1227 | free(path); | 1231 | free(path); |
| 1228 | return; | 1232 | return; |
| 1229 | } | 1233 | } |
| 1230 | |||
| 1231 | free(curdir); | 1234 | free(curdir); |
| 1232 | curdir = path; | 1235 | curdir = path; |
| 1233 | curdir_len = strlen(curdir); | 1236 | curdir_len = strlen(curdir); |
