Changeset 171 in MondoRescue for trunk/mondo/mondo/common/libmondo-tools.c


Ignore:
Timestamp:
Dec 8, 2005, 5:20:29 PM (18 years ago)
Author:
bcornec
Message:

memory management continues:

  • mondoarchive handled completely
  • bkpinfo, begining of dyn. alloc.
  • lot of changes around memory everywhere

=> even if it compiles, i'm pretty sure it doesn't work yet (even not tried)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/mondo/mondo/common/libmondo-tools.c

    r166 r171  
    605605        log_it("isomnt: %s, %d", tmp, strlen(tmp));
    606606        if (strlen(bkpinfo->isodir) < strlen(tmp)) {
    607             asprintf(&iso_path, "");
     607            asprintf(&iso_path, " ");
    608608        } else {
    609609            asprintf(&iso_path, "%s", bkpinfo->isodir + strlen(tmp));
     
    734734    bkpinfo->manual_cd_tray = FALSE;
    735735    bkpinfo->internal_tape_block_size = DEFAULT_INTERNAL_TAPE_BLOCK_SIZE;
    736     bkpinfo->media_device[0] = '\0';
     736    paranoid_free(bkpinfo->media_device);
    737737    for (i = 0; i <= MAX_NOOF_MEDIA; i++) {
    738738        bkpinfo->media_size[i] = -1;
     
    10981098
    10991099/**
    1100  * Whether we had to stop autofs (if so, restart it at end).
    1101  */
    1102 bool g_autofs_stopped = FALSE;
    1103 
    1104 /**
    1105  * Path to the autofs initscript ("" if none exists).
    1106  */
    1107 char g_autofs_exe[MAX_STR_LEN];
    1108 
    1109 /**
    1110  * Autofs initscript in Xandros Linux distribution.
    1111  */
    1112 #define XANDROS_AUTOFS_FNAME "/etc/init.d/xandros-autofs"
    1113 
    1114 /**
    1115  * Autofs initscript in most Linux distributions.
    1116  */
    1117 #define STOCK_AUTOFS_FNAME "/etc/rc.d/init.d/autofs"
    1118 
    1119 /**
    1120  * If autofs is mounted, stop it (restart at end).
    1121  */
    1122 void stop_autofs_if_necessary()
    1123 {
    1124     char *tmp;
    1125 
    1126     g_autofs_exe[0] = '\0';
    1127     if (does_file_exist(XANDROS_AUTOFS_FNAME)) {
    1128         strcpy(g_autofs_exe, XANDROS_AUTOFS_FNAME);
    1129     } else if (does_file_exist(STOCK_AUTOFS_FNAME)) {
    1130         strcpy(g_autofs_exe, STOCK_AUTOFS_FNAME);
    1131     }
    1132 
    1133     if (!g_autofs_exe[0]) {
    1134         log_msg(3, "No autofs detected.");
    1135     } else {
    1136         log_msg(3, "%s --- autofs detected", g_autofs_exe);
    1137 // FIXME -- only disable it if it's running ---  sprintf(tmp, "%s status", autofs_exe);
    1138         asprintf(&tmp, "%s stop", g_autofs_exe);
    1139         if (run_program_and_log_output(tmp, 2)) {
    1140             log_it("Failed to stop autofs - I assume it wasn't running");
    1141         } else {
    1142             g_autofs_stopped = TRUE;
    1143             log_it("Stopped autofs OK");
    1144         }
    1145         paranoid_free(tmp);
    1146     }
    1147 }
    1148 
    1149 /**
    1150  * If autofs was stopped earlier, restart it.
    1151  */
    1152 void restart_autofs_if_necessary()
    1153 {
    1154     char *tmp;
    1155 
    1156     if (!g_autofs_stopped || !g_autofs_exe[0]) {
    1157         log_msg(3, "No autofs detected.");
    1158         return;
    1159     }
    1160     asprintf(&tmp, "%s start", g_autofs_exe);
    1161     if (run_program_and_log_output(tmp, 2)) {
    1162         log_it("Failed to start autofs");
    1163     } else {
    1164         g_autofs_stopped = FALSE;
    1165         log_it("Started autofs OK");
    1166     }
    1167     paranoid_free(tmp);
    1168 }
    1169 
    1170 
    1171 /**
    11721100 * If this is a distribution like Gentoo that doesn't keep /boot mounted, mount it.
    11731101 */
     
    12141142                if (run_program_and_log_output(tmp1, 5)) {
    12151143                    paranoid_free(g_boot_mountpt);
    1216                     asprintf(&g_boot_mountpt, "");
     1144                    asprintf(&g_boot_mountpt, " ");
    12171145                    log_msg(1, "Plan B");
    12181146                    if (!run_program_and_log_output("mount /boot", 5)) {
Note: See TracChangeset for help on using the changeset viewer.