Ignore:
Timestamp:
Mar 7, 2024, 1:55:18 PM (2 months ago)
Author:
Bruno Cornec
Message:

Change find_my_editor and find_home_of_exe to return dynamically assigned stringsi - adapt whine_if_not_found

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3.3/mondo/src/mondorestore/mondorestore.c

    r3862 r3866  
    207207    mr_asprintf(tmp1,"%s/var/lib/multipath/bindings",bkpinfo->restore_path);
    208208    (void)unlink(tmp1);
    209     paranoid_free(tmp1);
     209    mr_free(tmp1);
    210210
    211211    /* Edit multipath.conf if needed to adapt wwid */
     
    214214        log_msg(2, "We may need to clean /etc/multipath.conf");
    215215    } else {
    216         paranoid_free(tmp1);
     216        mr_free(tmp1);
    217217        return;
    218218    }
    219     paranoid_free(tmp1);
     219    mr_free(tmp1);
    220220
    221221    if (bkpinfo->restore_mode != nuke) {
    222         mr_asprintf(editor, "%s", find_my_editor());
     222        editor = find_my_editor();
    223223        mr_asprintf(tmp1,"chroot %s %s /etc/multipath.conf", MNT_RESTORING, editor);
    224224        popup_and_OK("You will now edit multipath.conf");
     
    230230            newtResume();
    231231        }
    232         paranoid_free(tmp1);
    233         paranoid_free(editor);
     232        mr_free(tmp1);
     233        mr_free(editor);
    234234    } else {
    235235        log_to_screen("Non-interactive mode: no way to give you the keyboard so that you edit your multipath.conf. Hope it's OK");
     
    17671767
    17681768    log_msg(1, "restoring everything");
    1769     if (!find_home_of_exe("petris") && !g_text_mode) {
     1769    if (((tmp = find_home_of_exe("petris")) != NULL) && !g_text_mode) {
    17701770        newtDrawRootText(0, g_noof_rows - 2,
    17711771                         "Press ALT-<left cursor> twice to play Petris :-) ");
    17721772        newtRefresh();
    17731773    }
     1774    mr_free(tmp);
    17741775    mvaddstr_and_log_it(g_currentY, 0, "Preparing to read your archives");
    17751776    mount_media();
     
    18421843
    18431844  /** needs malloc **********/
     1845    char *tmp = NULL;
    18441846    char *tmp1 = NULL;
    18451847    char *fstab_fname = NULL;
     
    18811883        if (g_text_mode) {
    18821884            save_mountlist_to_disk(mountlist, g_mountlist_fname);
    1883             mr_asprintf(tmp1, "%s %s", find_my_editor(), g_mountlist_fname);
     1885            tmp = find_my_editor();
     1886            mr_asprintf(tmp1, "%s %s", tmp, g_mountlist_fname);
     1887            mr_free(tmp);
    18841888            res = system(tmp1);
    18851889            mr_free(tmp1);
Note: See TracChangeset for help on using the changeset viewer.