diff options
author | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2006-05-29 12:10:23 +0000 |
---|---|---|
committer | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2006-05-29 12:10:23 +0000 |
commit | d2c306e862abf49dd4b1ff1d1bd1a789317b7905 (patch) | |
tree | ea8e439001256f7f6da7683399115d009552d777 | |
parent | 1ec5b2905484b7904aabb01f56c70265fb538c82 (diff) | |
download | busybox-w32-d2c306e862abf49dd4b1ff1d1bd1a789317b7905.tar.gz busybox-w32-d2c306e862abf49dd4b1ff1d1bd1a789317b7905.tar.bz2 busybox-w32-d2c306e862abf49dd4b1ff1d1bd1a789317b7905.zip |
- ls: remove unused variable
- dpkg.c, diff: use xstat
text data bss dec hex filename
848823 9100 645216 1503139 16efa3 busybox_old
848679 9100 645216 1502995 16ef13 busybox_unstripped
bloatcheck is completely useless as it sees -79 for this, which is bogus.
-rw-r--r-- | archival/dpkg.c | 4 | ||||
-rw-r--r-- | coreutils/diff.c | 14 | ||||
-rw-r--r-- | coreutils/ls.c | 15 |
3 files changed, 12 insertions, 21 deletions
diff --git a/archival/dpkg.c b/archival/dpkg.c index c911333e0..32e51257e 100644 --- a/archival/dpkg.c +++ b/archival/dpkg.c | |||
@@ -874,9 +874,7 @@ static void write_status_file(deb_file_t **deb_file) | |||
874 | /* Create a separate backfile to dpkg */ | 874 | /* Create a separate backfile to dpkg */ |
875 | if (rename("/var/lib/dpkg/status", "/var/lib/dpkg/status.udeb.bak") == -1) { | 875 | if (rename("/var/lib/dpkg/status", "/var/lib/dpkg/status.udeb.bak") == -1) { |
876 | struct stat stat_buf; | 876 | struct stat stat_buf; |
877 | if (stat("/var/lib/dpkg/status", &stat_buf) == 0) { | 877 | xstat("/var/lib/dpkg/status", &stat_buf); |
878 | bb_error_msg_and_die("Couldnt create backup status file"); | ||
879 | } | ||
880 | /* Its ok if renaming the status file fails because status | 878 | /* Its ok if renaming the status file fails because status |
881 | * file doesnt exist, maybe we are starting from scratch */ | 879 | * file doesnt exist, maybe we are starting from scratch */ |
882 | bb_error_msg("No status file found, creating new one"); | 880 | bb_error_msg("No status file found, creating new one"); |
diff --git a/coreutils/diff.c b/coreutils/diff.c index c9274e64f..a1a74d51e 100644 --- a/coreutils/diff.c +++ b/coreutils/diff.c | |||
@@ -1237,13 +1237,13 @@ int diff_main(int argc, char **argv) { | |||
1237 | if (strcmp(argv[0], "-") == 0) { | 1237 | if (strcmp(argv[0], "-") == 0) { |
1238 | fstat(STDIN_FILENO, &stb1); | 1238 | fstat(STDIN_FILENO, &stb1); |
1239 | gotstdin = 1; | 1239 | gotstdin = 1; |
1240 | } else if (stat(argv[0], &stb1) != 0) | 1240 | } else |
1241 | bb_perror_msg_and_die("Couldn't stat %s", argv[0]); | 1241 | xstat(argv[0], &stb1); |
1242 | if (strcmp(argv[1], "-") == 0) { | 1242 | if (strcmp(argv[1], "-") == 0) { |
1243 | fstat(STDIN_FILENO, &stb2); | 1243 | fstat(STDIN_FILENO, &stb2); |
1244 | gotstdin = 1; | 1244 | gotstdin = 1; |
1245 | } else if (stat(argv[1], &stb2) != 0) | 1245 | } else |
1246 | bb_perror_msg_and_die("Couldn't stat %s", argv[1]); | 1246 | xstat(argv[1], &stb2); |
1247 | if (gotstdin && (S_ISDIR(stb1.st_mode) || S_ISDIR(stb2.st_mode))) | 1247 | if (gotstdin && (S_ISDIR(stb1.st_mode) || S_ISDIR(stb2.st_mode))) |
1248 | bb_error_msg_and_die("Can't compare - to a directory"); | 1248 | bb_error_msg_and_die("Can't compare - to a directory"); |
1249 | if (S_ISDIR(stb1.st_mode) && S_ISDIR(stb2.st_mode)) { | 1249 | if (S_ISDIR(stb1.st_mode) && S_ISDIR(stb2.st_mode)) { |
@@ -1256,13 +1256,11 @@ int diff_main(int argc, char **argv) { | |||
1256 | else { | 1256 | else { |
1257 | if (S_ISDIR(stb1.st_mode)) { | 1257 | if (S_ISDIR(stb1.st_mode)) { |
1258 | argv[0] = concat_path_file(argv[0], argv[1]); | 1258 | argv[0] = concat_path_file(argv[0], argv[1]); |
1259 | if (stat(argv[0], &stb1) < 0) | 1259 | xstat(argv[0], &stb1); |
1260 | bb_perror_msg_and_die("Couldn't stat %s", argv[0]); | ||
1261 | } | 1260 | } |
1262 | if (S_ISDIR(stb2.st_mode)) { | 1261 | if (S_ISDIR(stb2.st_mode)) { |
1263 | argv[1] = concat_path_file(argv[1], argv[0]); | 1262 | argv[1] = concat_path_file(argv[1], argv[0]); |
1264 | if (stat(argv[1], &stb2) < 0) | 1263 | xstat(argv[1], &stb2); |
1265 | bb_perror_msg_and_die("Couldn't stat %s", argv[1]); | ||
1266 | } | 1264 | } |
1267 | print_status(diffreg(argv[0], argv[1], 0), argv[0], argv[1], NULL); | 1265 | print_status(diffreg(argv[0], argv[1], 0), argv[0], argv[1], NULL); |
1268 | } | 1266 | } |
diff --git a/coreutils/ls.c b/coreutils/ls.c index 3fe0c8dad..9c0e8f17d 100644 --- a/coreutils/ls.c +++ b/coreutils/ls.c | |||
@@ -208,18 +208,15 @@ static struct dnode *my_stat(char *fullname, char *name) | |||
208 | #ifdef CONFIG_SELINUX | 208 | #ifdef CONFIG_SELINUX |
209 | security_context_t sid=NULL; | 209 | security_context_t sid=NULL; |
210 | #endif | 210 | #endif |
211 | int rc; | ||
212 | 211 | ||
213 | #ifdef CONFIG_FEATURE_LS_FOLLOWLINKS | 212 | #ifdef CONFIG_FEATURE_LS_FOLLOWLINKS |
214 | if (all_fmt & FOLLOW_LINKS) { | 213 | if (all_fmt & FOLLOW_LINKS) { |
215 | #ifdef CONFIG_SELINUX | 214 | #ifdef CONFIG_SELINUX |
216 | if (is_selinux_enabled()) { | 215 | if (is_selinux_enabled()) { |
217 | rc=0; /* Set the number which means success before hand. */ | 216 | getfilecon(fullname,&sid); |
218 | rc = getfilecon(fullname,&sid); | ||
219 | } | 217 | } |
220 | #endif | 218 | #endif |
221 | rc = stat(fullname, &dstat); | 219 | if (stat(fullname, &dstat)) { |
222 | if(rc) { | ||
223 | bb_perror_msg("%s", fullname); | 220 | bb_perror_msg("%s", fullname); |
224 | status = EXIT_FAILURE; | 221 | status = EXIT_FAILURE; |
225 | return 0; | 222 | return 0; |
@@ -229,12 +226,10 @@ static struct dnode *my_stat(char *fullname, char *name) | |||
229 | { | 226 | { |
230 | #ifdef CONFIG_SELINUX | 227 | #ifdef CONFIG_SELINUX |
231 | if (is_selinux_enabled()) { | 228 | if (is_selinux_enabled()) { |
232 | rc=0; /* Set the number which means success before hand. */ | 229 | lgetfilecon(fullname,&sid); |
233 | rc = lgetfilecon(fullname,&sid); | ||
234 | } | 230 | } |
235 | #endif | 231 | #endif |
236 | rc = lstat(fullname, &dstat); | 232 | if (lstat(fullname, &dstat)) { |
237 | if(rc) { | ||
238 | bb_perror_msg("%s", fullname); | 233 | bb_perror_msg("%s", fullname); |
239 | status = EXIT_FAILURE; | 234 | status = EXIT_FAILURE; |
240 | return 0; | 235 | return 0; |