Ignore:
Timestamp:
Dec 10, 2013, 8:50:00 AM (10 years ago)
Author:
Bruno Cornec
Message:
  • Fix typos preventnig compilation !
  • revert mr_getline modifications which where in fact incorrect
  • initialize log earlier so all messages go indeed in it
File:
1 edited

Legend:

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

    r3194 r3208  
    165165    FILE *fin = NULL;
    166166
    167 /* Make sure I'm root; abort if not */
     167    /* Make sure I'm root; abort if not */
    168168    if (getuid() != 0) {
    169169        fprintf(stderr, "Please run as root.\r\n");
    170         exit(127);
    171     }
    172 
    173 /* If -V, -v or --version then echo version no. and quit */
     170        finish(127);
     171    }
     172
     173    /* If -V, -v or --version then echo version no. and quit */
    174174    if (argc == 2 && (!strcmp(argv[argc - 1], "-v") || !strcmp(argv[argc - 1], "-V") || !strcmp(argv[argc - 1], "--version"))) {
    175175        printf("mondoarchive v%s\nSee man page for help\n", PACKAGE_VERSION);
    176         exit(0);
    177     }
    178 
    179 /* Initialize variables */
    180 
    181     printf("Initializing...\n");
    182     if (!(bkpinfo = (struct s_bkpinfo *)malloc(sizeof(struct s_bkpinfo)))) {
    183         fatal_error("Cannot malloc bkpinfo");
    184     }
    185     reset_bkpinfo();
    186 
    187     /* Memory allocation is done in those functions */
    188     malloc_libmondo_global_strings();
     176        finish(0);
     177    }
    189178
    190179    /* initialize log file with time stamp */
    191180    unlink(MONDO_LOGFILE);
    192181    log_msg(0, "Time started: %s", mr_date());
     182
     183    /* Initialize variables */
     184    if (!(bkpinfo = (struct s_bkpinfo *)malloc(sizeof(struct s_bkpinfo)))) {
     185        fprintf(stderr, "Cannot malloc bkpinfo\n");
     186        finish(-1);
     187    }
     188    log_msg(9, "reset_bkpinfo");
     189    reset_bkpinfo();
     190
     191    /* Memory allocation is done in those functions */
     192    malloc_libmondo_global_strings();
    193193
    194194    /* make sure PATH environmental variable allows access to mkfs, fdisk, etc. */
     
    351351    }
    352352
    353 /* Finish configuring global structures */
     353    /* Finish configuring global structures */
    354354    if (post_param_configuration()) {
    355355        fatal_error("Post-param initialization phase failed. Perhaps bad parameters were supplied to mondoarchive? Please review the documentation, error messages and logs. Exiting...");
Note: See TracChangeset for help on using the changeset viewer.