- 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.
This commit is contained in:
Bernhard Reutner-Fischer 2006-05-29 12:10:23 +00:00
parent 1ec5b29054
commit d2c306e862
3 changed files with 12 additions and 21 deletions

View File

@ -874,9 +874,7 @@ static void write_status_file(deb_file_t **deb_file)
/* Create a separate backfile to dpkg */ /* Create a separate backfile to dpkg */
if (rename("/var/lib/dpkg/status", "/var/lib/dpkg/status.udeb.bak") == -1) { if (rename("/var/lib/dpkg/status", "/var/lib/dpkg/status.udeb.bak") == -1) {
struct stat stat_buf; struct stat stat_buf;
if (stat("/var/lib/dpkg/status", &stat_buf) == 0) { xstat("/var/lib/dpkg/status", &stat_buf);
bb_error_msg_and_die("Couldnt create backup status file");
}
/* Its ok if renaming the status file fails because status /* Its ok if renaming the status file fails because status
* file doesnt exist, maybe we are starting from scratch */ * file doesnt exist, maybe we are starting from scratch */
bb_error_msg("No status file found, creating new one"); bb_error_msg("No status file found, creating new one");

View File

@ -1237,13 +1237,13 @@ int diff_main(int argc, char **argv) {
if (strcmp(argv[0], "-") == 0) { if (strcmp(argv[0], "-") == 0) {
fstat(STDIN_FILENO, &stb1); fstat(STDIN_FILENO, &stb1);
gotstdin = 1; gotstdin = 1;
} else if (stat(argv[0], &stb1) != 0) } else
bb_perror_msg_and_die("Couldn't stat %s", argv[0]); xstat(argv[0], &stb1);
if (strcmp(argv[1], "-") == 0) { if (strcmp(argv[1], "-") == 0) {
fstat(STDIN_FILENO, &stb2); fstat(STDIN_FILENO, &stb2);
gotstdin = 1; gotstdin = 1;
} else if (stat(argv[1], &stb2) != 0) } else
bb_perror_msg_and_die("Couldn't stat %s", argv[1]); xstat(argv[1], &stb2);
if (gotstdin && (S_ISDIR(stb1.st_mode) || S_ISDIR(stb2.st_mode))) if (gotstdin && (S_ISDIR(stb1.st_mode) || S_ISDIR(stb2.st_mode)))
bb_error_msg_and_die("Can't compare - to a directory"); bb_error_msg_and_die("Can't compare - to a directory");
if (S_ISDIR(stb1.st_mode) && S_ISDIR(stb2.st_mode)) { if (S_ISDIR(stb1.st_mode) && S_ISDIR(stb2.st_mode)) {
@ -1256,13 +1256,11 @@ int diff_main(int argc, char **argv) {
else { else {
if (S_ISDIR(stb1.st_mode)) { if (S_ISDIR(stb1.st_mode)) {
argv[0] = concat_path_file(argv[0], argv[1]); argv[0] = concat_path_file(argv[0], argv[1]);
if (stat(argv[0], &stb1) < 0) xstat(argv[0], &stb1);
bb_perror_msg_and_die("Couldn't stat %s", argv[0]);
} }
if (S_ISDIR(stb2.st_mode)) { if (S_ISDIR(stb2.st_mode)) {
argv[1] = concat_path_file(argv[1], argv[0]); argv[1] = concat_path_file(argv[1], argv[0]);
if (stat(argv[1], &stb2) < 0) xstat(argv[1], &stb2);
bb_perror_msg_and_die("Couldn't stat %s", argv[1]);
} }
print_status(diffreg(argv[0], argv[1], 0), argv[0], argv[1], NULL); print_status(diffreg(argv[0], argv[1], 0), argv[0], argv[1], NULL);
} }

View File

@ -208,18 +208,15 @@ static struct dnode *my_stat(char *fullname, char *name)
#ifdef CONFIG_SELINUX #ifdef CONFIG_SELINUX
security_context_t sid=NULL; security_context_t sid=NULL;
#endif #endif
int rc;
#ifdef CONFIG_FEATURE_LS_FOLLOWLINKS #ifdef CONFIG_FEATURE_LS_FOLLOWLINKS
if (all_fmt & FOLLOW_LINKS) { if (all_fmt & FOLLOW_LINKS) {
#ifdef CONFIG_SELINUX #ifdef CONFIG_SELINUX
if (is_selinux_enabled()) { if (is_selinux_enabled()) {
rc=0; /* Set the number which means success before hand. */ getfilecon(fullname,&sid);
rc = getfilecon(fullname,&sid);
} }
#endif #endif
rc = stat(fullname, &dstat); if (stat(fullname, &dstat)) {
if(rc) {
bb_perror_msg("%s", fullname); bb_perror_msg("%s", fullname);
status = EXIT_FAILURE; status = EXIT_FAILURE;
return 0; return 0;
@ -229,12 +226,10 @@ static struct dnode *my_stat(char *fullname, char *name)
{ {
#ifdef CONFIG_SELINUX #ifdef CONFIG_SELINUX
if (is_selinux_enabled()) { if (is_selinux_enabled()) {
rc=0; /* Set the number which means success before hand. */ lgetfilecon(fullname,&sid);
rc = lgetfilecon(fullname,&sid);
} }
#endif #endif
rc = lstat(fullname, &dstat); if (lstat(fullname, &dstat)) {
if(rc) {
bb_perror_msg("%s", fullname); bb_perror_msg("%s", fullname);
status = EXIT_FAILURE; status = EXIT_FAILURE;
return 0; return 0;