Ignore:
Timestamp:
Aug 18, 2009, 5:28:18 PM (15 years ago)
Author:
Bruno Cornec
Message:

r3369@localhost: bruno | 2009-08-18 16:57:27 +0200

  • Transform bout 100 strcpy in dyn. allocation. Quality is improving
  • function figure_out_kernel_path_interactively_if_necessary now return a dynamically allocated string
  • mondoarchive checked with valgrind in text an newt modes
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2.10/mondo/src/common/libmondo-files.c

    r2332 r2334  
    269269 * @return 0 for success, 1 for failure.
    270270 */
    271 int figure_out_kernel_path_interactively_if_necessary(char *kernel)
    272 {
     271char *figure_out_kernel_path_interactively_if_necessary(void) {
     272
    273273    char *tmp = NULL;
    274274    char *command = NULL;;
    275 
    276     if (kernel == NULL) {
    277         mr_asprintf(kernel, "%s", call_program_and_get_last_line_of_output("mindi --findkernel 2> /dev/null"));
    278     }
     275    char *kernel = NULL;;
     276
     277    mr_asprintf(kernel, "%s", call_program_and_get_last_line_of_output("mindi --findkernel 2> /dev/null"));
     278   
    279279    // If we didn't get anything back, check whether mindi raised a fatal error
    280280    if (!kernel[0]) {
     
    285285            mr_free(tmp);
    286286            mr_free(command);
     287            mr_free(kernel);
    287288            fatal_error("Mindi gave a fatal error. Please check '/var/log/mindi.log'.");
    288289        }
     
    293294    while (!kernel[0]) {
    294295        if (!ask_me_yes_or_no("Kernel not found or invalid. Choose another?")) {
    295             return (1);
     296            return (NULL);
    296297        }
    297298        tmp = popup_and_get_string("Kernel path", "What is the full path and filename of your kernel, please?", kernel);
     
    304305        log_it("User says kernel is at %s", kernel);
    305306    }
    306     return (0);
     307    return (kernel);
    307308}
    308309
     
    11031104    }
    11041105    *(p++) = '\0';
    1105     mr_asprintf(nfs_server_ipaddr, tmp);
    1106     mr_asprintf(nfs_mount, p);
     1106    mr_asprintf(nfs_server_ipaddr, "%s", tmp);
     1107    mr_asprintf(nfs_mount, "%s", p);
    11071108    mr_free(tmp);
    11081109
     
    11511152        mr_free(nfs_dev);
    11521153
    1153         mr_asprintf(nfs_dev, call_program_and_get_last_line_of_output(command));
     1154        mr_asprintf(nfs_dev, "%s", call_program_and_get_last_line_of_output(command));
    11541155        mr_free(command);
    11551156
Note: See TracChangeset for help on using the changeset viewer.