Changeset 3208


Ignore:
Timestamp:
Dec 10, 2013, 8:50:00 AM (5 years ago)
Author:
bruno
Message:
  • Fix typos preventnig compilation !
  • revert mr_getline modifications which where in fact incorrect
  • initialize log earlier so all messages go indeed in it
Location:
branches/3.2/mondo/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/3.2/mondo/src/common/libmondo-archive.c

    r3207 r3208  
    780780        log_msg(1, "%ld: Unable to write one-liner bootloader.name", __LINE__);
    781781    }
    782     r_free(bootldr_str);
     782    mr_free(bootldr_str);
    783783    mr_free(tmp);
    784784
  • branches/3.2/mondo/src/common/newt-specific.c

    r3207 r3208  
    417417        mr_free(bkpinfo->netfs_user);
    418418        mr_free(bkpinfo->netfs_proto);
    419         mr_free(bkpinfo->netfs_remotedir);
     419        mr_free(bkpinfo->netfs_remote_dir);
    420420        mr_free(bkpinfo->exclude_devs);
    421421        mr_free(bkpinfo->exclude_paths);
  • branches/3.2/mondo/src/lib/mr_mem.c

    r3205 r3208  
    7474    size_t n = 0;
    7575
    76     /*  We reached end of file, allocating empty string */
    77     if (feof(fd)) {
    78         mr_asprintf_int(lineptr, line, file, "");
    79         return;
    80     }
    8176    ret = getline(lineptr,&n,fd);
    82     if (ret == -1) {
     77    if ((ret == -1) && (! feof(fd))) {
    8378        mr_msg_int(1,line,file,"Unable to alloc memory in mr_getline\nExiting...");
    8479        mr_exit(-1,"Unable to alloc memory in mr_getline");
     80    }
     81    /*  We reached end of file, allocating empty string */
     82    if (ret == -1) {
     83        mr_asprintf_int(lineptr, line, file, "");
    8584    }
    8685}
  • 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.