Changeset 3836 in MondoRescue for branches/3.3/mondo/src/mondorestore
- Timestamp:
- Mar 5, 2024, 2:50:53 AM (18 months ago)
- Location:
- branches/3.3/mondo/src/mondorestore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3.3/mondo/src/mondorestore/mondo-rstr-tools.c
r3835 r3836 252 252 * @return TRUE if OK was pressed, FALSE otherwise. 253 253 */ 254 bool 255 get_isodir_info(char *isodir_device, char *isodir_format, 254 bool get_isodir_info(char *isodir_device, char *isodir_format, 256 255 struct s_bkpinfo *bkpinfo, bool nuke_me_please) 257 256 { 258 257 259 258 bool HDD = FALSE; 259 char *tmp = NULL; 260 260 /** initialize ********************************************************/ 261 261 … … 269 269 strcpy(isodir_device, "/dev/"); 270 270 } 271 if (bkpinfo->isodir[0] == '\0') {272 strcpy(bkpinfo->isodir, "/");273 } 274 // TODO: Are we s hure it does what it's expected to do here ?271 if (bkpinfo->isodir[0] == NULL) { 272 mr_asprintf(bkpinfo->isodir, "%s", "/"); 273 } 274 // TODO: Are we sure it does what it's expected to do here ? 275 275 if (does_file_exist("/tmp/NETFS-SERVER-MOUNT")) { 276 276 strcpy(isodir_device, last_line_of_file("/tmp/NETFS-SERVER-MOUNT")); 277 277 strcpy(isodir_format, "netfs"); 278 strcpy(bkpinfo->isodir, last_line_of_file("/tmp/ISO-DIR"));278 mr_asprintf(bkpinfo->isodir, "%s", last_line_of_file("/tmp/ISO-DIR")); 279 279 } 280 280 if (nuke_me_please) { … … 287 287 HDD = TRUE; 288 288 } 289 if (popup_and_get_string ("ISO Mode - path", "At what path on this device can the ISO files be found ?", bkpinfo->isodir, MAX_STR_LEN / 4)) { 289 tmp = mr_popup_and_get_string ("ISO Mode - path", "At what path on this device can the ISO files be found ?", bkpinfo->isodir); 290 if (tmp) { 290 291 strip_spaces(isodir_device); 291 292 strip_spaces(isodir_format); 292 strip_spaces(bkpinfo->isodir); 293 bkpinfo->isodir = mr_strip_spaces(tmp); 294 mr_free(tmp); 293 295 log_it("isodir_device = %s - isodir_format = %s - bkpinfo->isodir = %s", isodir_device, isodir_format, bkpinfo->isodir); 294 296 if (HDD) { 295 297 /* We need an additional param */ 296 298 mr_asprintf(bkpinfo->subdir, "%s", bkpinfo->isodir); 297 strcpy(bkpinfo->isodir, "/tmp/isodir");299 mr_asprintf(bkpinfo->isodir, "%s", "/tmp/isodir"); 298 300 log_it("Now bkpinfo->isodir = %s and subdir = ", bkpinfo->isodir, bkpinfo->subdir); 299 301 } … … 326 328 if (bkpinfo->disaster_recovery) { 327 329 /* Don't let this clobber an existing bkpinfo->isodir */ 328 if ( !bkpinfo->isodir[0]) {329 strcpy(bkpinfo->isodir, "/tmp/isodir");330 if (bkpinfo->isodir == NULL) { 331 mr_asprintf(bkpinfo->isodir, "%s", "/tmp/isodir"); 330 332 } 331 333 mr_asprintf(command, "mkdir -p %s", bkpinfo->isodir); … … 925 927 */ 926 928 mr_asprintf(old_isodir, "%s", bkpinfo->isodir); 927 read_cfg_var(cfg_file, "iso-mnt", iso_mnt); 928 read_cfg_var(cfg_file, "iso-dir", iso_path); 929 snprintf(bkpinfo->isodir, (MAX_STR_LEN / 4)-1, "%s%s", iso_mnt, iso_path); 930 if (!bkpinfo->isodir[0]) { 931 strcpy(bkpinfo->isodir, old_isodir); 932 } 929 if (read_cfg_var(cfg_file, "iso-mnt", iso_mnt) != 0) { 930 iso_mnt[0] = '\0'; 931 } 932 if (read_cfg_var(cfg_file, "iso-dir", iso_path) != 0) { 933 iso_path[0] = '\0'; 934 } 935 mr_asprintf(bkpinfo->isodir, "%s%s", iso_mnt, iso_path); 936 if (!strcmpbkpinfo->isodir,"") { 937 mr_asprintf(bkpinfo->isodir, "%s", old_isodir); 938 } 939 933 940 if ((!bkpinfo->disaster_recovery) || (g_isodir_device[0] != '\0')) { 934 941 if (strcmp(old_isodir, bkpinfo->isodir)) { 935 942 log_it("user nominated isodir %s differs from archive, keeping user's choice: %s\n", bkpinfo->isodir, old_isodir ); 936 strcpy(bkpinfo->isodir, old_isodir);943 mr_asprintf(bkpinfo->isodir, "%s", old_isodir); 937 944 } 938 945 } … … 969 976 bkpinfo->backup_media_type = cdr; 970 977 mr_asprintf(bkpinfo->media_device, "%s", "/dev/cdrom"); /* superfluous */ 971 bkpinfo->isodir[0] = iso_mnt[0] = iso_path[0] = '\0'; 978 mr_free(bkpinfo->isodir); 979 iso_mnt[0] = iso_path[0] = '\0'; 972 980 if (mount_media()) { 973 981 mr_free(tmp1); … … 982 990 /* except when already done in iso_fiddly_bits */ 983 991 if ((bkpinfo->backup_media_type == iso) && (g_isodir_device[0] == '\0')) { 984 sprintf(bkpinfo->isodir, "%s%s", iso_mnt, iso_path);992 mr_asprintf(bkpinfo->isodir, "%s%s", iso_mnt, iso_path); 985 993 } 986 994 } -
branches/3.3/mondo/src/mondorestore/mondorestore.c
r3833 r3836 2843 2843 if ((bkpinfo->backup_media_type == netfs) && bkpinfo->netfs_mount && !is_this_device_mounted(bkpinfo->netfs_mount)) { 2844 2844 log_msg(1, "Mounting remote %s dir", bkpinfo->netfs_proto); 2845 sprintf(bkpinfo->isodir, "/tmp/isodir");2845 mr_asprintf(bkpinfo->isodir, "%s", "/tmp/isodir"); 2846 2846 run_program_and_log_output("mkdir -p /tmp/isodir", 5); 2847 2847 if (strstr(bkpinfo->netfs_proto, "sshfs")) {
Note:
See TracChangeset
for help on using the changeset viewer.