Changeset 2725 in MondoRescue for branches/2.2.9/mindi-busybox/selinux/setfiles.c
- Timestamp:
- Feb 25, 2011, 9:26:54 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2.9/mindi-busybox/selinux/setfiles.c
r1765 r2725 36 36 int nerr; 37 37 struct edir excludeArray[MAX_EXCLUDES]; 38 }; 39 38 } FIX_ALIASING; 40 39 #define G (*(struct globals*)&bb_common_bufsiz1) 41 40 void BUG_setfiles_globals_too_big(void); … … 100 99 101 100 102 static void qprintf(const char *fmt , ...)101 static void qprintf(const char *fmt UNUSED_PARAM, ...) 103 102 { 104 103 /* quiet, do nothing */ … … 113 112 } 114 113 115 static void add_exclude(const char * constdirectory)114 static void add_exclude(const char *directory) 116 115 { 117 116 struct stat sb; … … 120 119 if (directory == NULL || directory[0] != '/') { 121 120 bb_error_msg_and_die("full path required for exclude: %s", directory); 122 123 121 } 124 122 if (lstat(directory, &sb)) { … … 285 283 count = (count % (80*0x400)); 286 284 if (count == 0) 287 fputc('\n', stdout);288 fputc('*', stdout);289 fflush (stdout);285 bb_putchar('\n'); 286 bb_putchar('*'); 287 fflush_all(); 290 288 } 291 289 } … … 348 346 if (verbose > 1 || !user_only_changed) { 349 347 bb_info_msg("%s: reset %s context %s->%s", 350 applet_name, my_file, context ? : "", newcon);348 applet_name, my_file, context ? context : "", newcon); 351 349 } 352 350 } … … 392 390 * the directory traversal. 393 391 */ 394 static int apply_spec(const char *file, 395 struct stat *sb, void *userData, int depth) 392 static int FAST_FUNC apply_spec( 393 const char *file, 394 struct stat *sb, 395 void *userData UNUSED_PARAM, 396 int depth UNUSED_PARAM) 396 397 { 397 398 if (!follow_mounts) { … … 487 488 } 488 489 489 int setfiles_main(int argc, char **argv) ;490 int setfiles_main(int argc , char **argv)490 int setfiles_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 491 int setfiles_main(int argc UNUSED_PARAM, char **argv) 491 492 { 492 493 struct stat sb; … … 542 543 } else { /* setfiles */ 543 544 flags = getopt32(argv, "de:f:ilnpqr:svo:FW" 544 USE_FEATURE_SETFILES_CHECK_OPTION("c:"),545 IF_FEATURE_SETFILES_CHECK_OPTION("c:"), 545 546 &exclude_dir, &input_filename, &rootpath, &out_filename, 546 USE_FEATURE_SETFILES_CHECK_OPTION(&policyfile,)547 IF_FEATURE_SETFILES_CHECK_OPTION(&policyfile,) 547 548 &verbose); 548 549 } 550 argv += optind; 549 551 550 552 #if ENABLE_FEATURE_SETFILES_CHECK_OPTION … … 552 554 FILE *policystream; 553 555 554 policystream = xfopen (policyfile, "r");556 policystream = xfopen_for_read(policyfile); 555 557 if (sepol_set_policydb_from_file(policystream) < 0) { 556 558 bb_error_msg_and_die("sepol_set_policydb_from_file on %s", policyfile); … … 573 575 outfile = stdout; 574 576 if (NOT_LONE_CHAR(out_filename, '-')) { 575 outfile = xfopen (out_filename, "w");577 outfile = xfopen_for_write(out_filename); 576 578 } 577 579 } … … 593 595 checking against a binary policy file. */ 594 596 set_matchpathcon_canoncon(&canoncon); 595 if ( argc == 1)597 if (!argv[0]) 596 598 bb_show_usage(); 597 if (stat(argv[optind], &sb) < 0) { 598 bb_perror_msg_and_die("%s", argv[optind]); 599 } 599 xstat(argv[0], &sb); 600 600 if (!S_ISREG(sb.st_mode)) { 601 bb_error_msg_and_die("spec file %s is not a regular file", argv[ optind]);601 bb_error_msg_and_die("spec file %s is not a regular file", argv[0]); 602 602 } 603 603 /* Load the file contexts configuration and check it. */ 604 rc = matchpathcon_init(argv[ optind]);604 rc = matchpathcon_init(argv[0]); 605 605 if (rc < 0) { 606 bb_perror_msg_and_die("%s", argv[optind]); 607 } 608 609 optind++; 610 606 bb_simple_perror_msg_and_die(argv[0]); 607 } 611 608 if (nerr) 612 exit(1); 609 exit(EXIT_FAILURE); 610 argv++; 613 611 } 614 612 … … 618 616 619 617 if (NOT_LONE_CHAR(input_filename, '-')) 620 f = xfopen (input_filename, "r");618 f = xfopen_for_read(input_filename); 621 619 while ((len = getline(&buf, &buf_len, f)) > 0) { 622 620 buf[len - 1] = '\0'; … … 626 624 fclose_if_not_stdin(f); 627 625 } else { 628 if ( optind >= argc)626 if (!argv[0]) 629 627 bb_show_usage(); 630 for (i = optind; i < argc; i++) {628 for (i = 0; argv[i]; i++) { 631 629 errors |= process_one(argv[i]); 632 630 }
Note:
See TracChangeset
for help on using the changeset viewer.