diff options
Diffstat (limited to 'coreutils/ls.c')
-rw-r--r-- | coreutils/ls.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/coreutils/ls.c b/coreutils/ls.c index e2ed3ee1f..a5bd0e304 100644 --- a/coreutils/ls.c +++ b/coreutils/ls.c | |||
@@ -132,8 +132,8 @@ enum { show_color = 0 }; | |||
132 | * a directory entry and its stat info are stored here | 132 | * a directory entry and its stat info are stored here |
133 | */ | 133 | */ |
134 | struct dnode { /* the basic node */ | 134 | struct dnode { /* the basic node */ |
135 | char *name; /* the dir entry name */ | 135 | const char *name; /* the dir entry name */ |
136 | char *fullname; /* the dir entry name */ | 136 | const char *fullname; /* the dir entry name */ |
137 | int allocated; | 137 | int allocated; |
138 | struct stat dstat; /* the file stat info */ | 138 | struct stat dstat; /* the file stat info */ |
139 | USE_SELINUX(security_context_t sid;) | 139 | USE_SELINUX(security_context_t sid;) |
@@ -159,7 +159,7 @@ enum { | |||
159 | 159 | ||
160 | static int status = EXIT_SUCCESS; | 160 | static int status = EXIT_SUCCESS; |
161 | 161 | ||
162 | static struct dnode *my_stat(char *fullname, char *name, int force_follow) | 162 | static struct dnode *my_stat(const char *fullname, const char *name, int force_follow) |
163 | { | 163 | { |
164 | struct stat dstat; | 164 | struct stat dstat; |
165 | struct dnode *cur; | 165 | struct dnode *cur; |
@@ -241,7 +241,7 @@ static int count_dirs(struct dnode **dn, int nfiles, int notsubdirs) | |||
241 | return 0; | 241 | return 0; |
242 | dirs = 0; | 242 | dirs = 0; |
243 | for (i = 0; i < nfiles; i++) { | 243 | for (i = 0; i < nfiles; i++) { |
244 | char *name; | 244 | const char *name; |
245 | if (!S_ISDIR(dn[i]->dstat.st_mode)) | 245 | if (!S_ISDIR(dn[i]->dstat.st_mode)) |
246 | continue; | 246 | continue; |
247 | name = dn[i]->name; | 247 | name = dn[i]->name; |
@@ -288,7 +288,7 @@ static void dfree(struct dnode **dnp, int nfiles) | |||
288 | for (i = 0; i < nfiles; i++) { | 288 | for (i = 0; i < nfiles; i++) { |
289 | struct dnode *cur = dnp[i]; | 289 | struct dnode *cur = dnp[i]; |
290 | if (cur->allocated) | 290 | if (cur->allocated) |
291 | free(cur->fullname); /* free the filename */ | 291 | free((char*)cur->fullname); /* free the filename */ |
292 | free(cur); /* free the dnode */ | 292 | free(cur); /* free the dnode */ |
293 | } | 293 | } |
294 | free(dnp); /* free the array holding the dnode pointers */ | 294 | free(dnp); /* free the array holding the dnode pointers */ |
@@ -320,7 +320,7 @@ static struct dnode **splitdnarray(struct dnode **dn, int nfiles, int which) | |||
320 | /* copy the entrys into the file or dir array */ | 320 | /* copy the entrys into the file or dir array */ |
321 | for (d = i = 0; i < nfiles; i++) { | 321 | for (d = i = 0; i < nfiles; i++) { |
322 | if (S_ISDIR(dn[i]->dstat.st_mode)) { | 322 | if (S_ISDIR(dn[i]->dstat.st_mode)) { |
323 | char *name; | 323 | const char *name; |
324 | if (!(which & (SPLIT_DIR|SPLIT_SUBDIR))) | 324 | if (!(which & (SPLIT_DIR|SPLIT_SUBDIR))) |
325 | continue; | 325 | continue; |
326 | name = dn[i]->name; | 326 | name = dn[i]->name; |
@@ -513,7 +513,7 @@ static struct dnode **list_dir(const char *path) | |||
513 | continue; | 513 | continue; |
514 | } | 514 | } |
515 | fullname = concat_path_file(path, entry->d_name); | 515 | fullname = concat_path_file(path, entry->d_name); |
516 | cur = my_stat(fullname, strrchr(fullname, '/') + 1, 0); | 516 | cur = my_stat(fullname, bb_basename(fullname), 0); |
517 | if (!cur) { | 517 | if (!cur) { |
518 | free(fullname); | 518 | free(fullname); |
519 | continue; | 519 | continue; |