Ignore:
Timestamp:
Feb 25, 2011, 9:26:54 PM (13 years ago)
Author:
Bruno Cornec
Message:
  • Update mindi-busybox to 1.18.3 to avoid problems with the tar command which is now failing on recent versions with busybox 1.7.3
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2.9/mindi-busybox/selinux/setfiles.c

    r1765 r2725  
    3636    int nerr;
    3737    struct edir excludeArray[MAX_EXCLUDES];
    38 };
    39 
     38} FIX_ALIASING;
    4039#define G (*(struct globals*)&bb_common_bufsiz1)
    4140void BUG_setfiles_globals_too_big(void);
     
    10099
    101100
    102 static void qprintf(const char *fmt, ...)
     101static void qprintf(const char *fmt UNUSED_PARAM, ...)
    103102{
    104103    /* quiet, do nothing */
     
    113112}
    114113
    115 static void add_exclude(const char *const directory)
     114static void add_exclude(const char *directory)
    116115{
    117116    struct stat sb;
     
    120119    if (directory == NULL || directory[0] != '/') {
    121120        bb_error_msg_and_die("full path required for exclude: %s", directory);
    122 
    123121    }
    124122    if (lstat(directory, &sb)) {
     
    285283            count = (count % (80*0x400));
    286284            if (count == 0)
    287                 fputc('\n', stdout);
    288             fputc('*', stdout);
    289             fflush(stdout);
     285                bb_putchar('\n');
     286            bb_putchar('*');
     287            fflush_all();
    290288        }
    291289    }
     
    348346        if (verbose > 1 || !user_only_changed) {
    349347            bb_info_msg("%s: reset %s context %s->%s",
    350                 applet_name, my_file, context ?: "", newcon);
     348                applet_name, my_file, context ? context : "", newcon);
    351349        }
    352350    }
     
    392390 * the directory traversal.
    393391 */
    394 static int apply_spec(const char *file,
    395               struct stat *sb, void *userData, int depth)
     392static int FAST_FUNC apply_spec(
     393        const char *file,
     394        struct stat *sb,
     395        void *userData UNUSED_PARAM,
     396        int depth UNUSED_PARAM)
    396397{
    397398    if (!follow_mounts) {
     
    487488}
    488489
    489 int setfiles_main(int argc, char **argv);
    490 int setfiles_main(int argc, char **argv)
     490int setfiles_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
     491int setfiles_main(int argc UNUSED_PARAM, char **argv)
    491492{
    492493    struct stat sb;
     
    542543    } else { /* setfiles */
    543544        flags = getopt32(argv, "de:f:ilnpqr:svo:FW"
    544                 USE_FEATURE_SETFILES_CHECK_OPTION("c:"),
     545                IF_FEATURE_SETFILES_CHECK_OPTION("c:"),
    545546            &exclude_dir, &input_filename, &rootpath, &out_filename,
    546                  USE_FEATURE_SETFILES_CHECK_OPTION(&policyfile,)
     547                 IF_FEATURE_SETFILES_CHECK_OPTION(&policyfile,)
    547548            &verbose);
    548549    }
     550    argv += optind;
    549551
    550552#if ENABLE_FEATURE_SETFILES_CHECK_OPTION
     
    552554        FILE *policystream;
    553555
    554         policystream = xfopen(policyfile, "r");
     556        policystream = xfopen_for_read(policyfile);
    555557        if (sepol_set_policydb_from_file(policystream) < 0) {
    556558            bb_error_msg_and_die("sepol_set_policydb_from_file on %s", policyfile);
     
    573575        outfile = stdout;
    574576        if (NOT_LONE_CHAR(out_filename, '-')) {
    575             outfile = xfopen(out_filename, "w");
     577            outfile = xfopen_for_write(out_filename);
    576578        }
    577579    }
     
    593595           checking against a binary policy file. */
    594596        set_matchpathcon_canoncon(&canoncon);
    595         if (argc == 1)
     597        if (!argv[0])
    596598            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);
    600600        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]);
    602602        }
    603603        /* Load the file contexts configuration and check it. */
    604         rc = matchpathcon_init(argv[optind]);
     604        rc = matchpathcon_init(argv[0]);
    605605        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        }
    611608        if (nerr)
    612             exit(1);
     609            exit(EXIT_FAILURE);
     610        argv++;
    613611    }
    614612
     
    618616
    619617        if (NOT_LONE_CHAR(input_filename, '-'))
    620             f = xfopen(input_filename, "r");
     618            f = xfopen_for_read(input_filename);
    621619        while ((len = getline(&buf, &buf_len, f)) > 0) {
    622620            buf[len - 1] = '\0';
     
    626624            fclose_if_not_stdin(f);
    627625    } else {
    628         if (optind >= argc)
     626        if (!argv[0])
    629627            bb_show_usage();
    630         for (i = optind; i < argc; i++) {
     628        for (i = 0; argv[i]; i++) {
    631629            errors |= process_one(argv[i]);
    632630        }
Note: See TracChangeset for help on using the changeset viewer.