Changes in branches/3.2 [3333:3332] in MondoRescue


Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3.2/mondo/src/mondoarchive/mondoarchive.c

    r3333 r3332  
    165165    FILE *fin = NULL;
    166166
     167    /* Make sure I'm root; abort if not */
     168    if (getuid() != 0) {
     169        fprintf(stderr, "Please run as root.\r\n");
     170        finish(127);
     171    }
     172
    167173    /* If -V, -v or --version then echo version no. and quit */
    168174    if (argc == 2 && (!strcmp(argv[argc - 1], "-v") || !strcmp(argv[argc - 1], "-V") || !strcmp(argv[argc - 1], "--version"))) {
    169175        printf("mondoarchive v%s\nSee man page for help\n", PACKAGE_VERSION);
    170         if (getuid() != 0) fprintf(stderr, "Please run the mondoarchive command as root.\n");
    171         exit(0);
    172     }
    173 
    174     /* Make sure I'm root; abort if not */
    175     if (getuid() != 0) {
    176         fprintf(stderr, "Please run as root.\n");
    177         exit(127);
     176        finish(0);
    178177    }
    179178
     
    185184    if (!(bkpinfo = (struct s_bkpinfo *)malloc(sizeof(struct s_bkpinfo)))) {
    186185        fprintf(stderr, "Cannot malloc bkpinfo\n");
    187         exit(-1);
    188     }
    189     /*  Now on we can use finish to exit as bkpingo has been initialized */
     186        finish(-1);
     187    }
    190188    log_msg(9, "reset_bkpinfo");
    191189    reset_bkpinfo();
Note: See TracChangeset for help on using the changeset viewer.