Changeset 3060 in MondoRescue for branches/3.0/mondo/src/common/libmondo-devices.c
- Timestamp:
- Nov 10, 2012, 5:05:37 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3.0/mondo/src/common/libmondo-devices.c
r3052 r3060 348 348 char *searchstr = NULL; 349 349 char *tmp; 350 char *p; 350 351 351 352 /*@ ints ******************************************************* */ … … 383 384 (void) build_partition_name(searchstr, drive, partno); 384 385 strcat(searchstr, " "); 385 for (res = 0; !res && fgets(incoming, MAX_STR_LEN - 1, fin);) {386 for (res = 0; !res && (p = fgets(incoming, MAX_STR_LEN - 1, fin));) { 386 387 if (strstr(incoming, searchstr)) { 387 388 res = 1; … … 677 678 return (1); 678 679 } 679 for ( (void)fgets(tmp, MAX_STR_LEN, fin); !feof(fin);680 (void)fgets(tmp, MAX_STR_LEN, fin)) {680 for (tmp1 = fgets(tmp, MAX_STR_LEN, fin); !feof(fin) && (tmp1 != NULL); 681 tmp1 = fgets(tmp, MAX_STR_LEN, fin)) { 681 682 p = strchr(tmp, '\''); 682 683 if (p) { … … 711 712 log_msg(4, "Cannot run 2nd command - non-fatal, fortunately"); 712 713 } else { 713 for ( (void)fgets(tmp, MAX_STR_LEN, fin); !feof(fin);714 (void)fgets(tmp, MAX_STR_LEN, fin)) {714 for (tmp1 = fgets(tmp, MAX_STR_LEN, fin); !feof(fin) && (tmp1 != NULL); 715 tmp1 = fgets(tmp, MAX_STR_LEN, fin)) { 715 716 log_msg(5, "--> '%s'", tmp); 716 717 if (tmp[0] != ' ' && tmp[1] != ' ') { … … 915 916 } 916 917 917 sprintf(tmp, "%s", call_program_and_get_last_line_of_output 918 ("dvdrecord -scanbus 2> /dev/null | grep \)\ \' | grep -n '' | grep -E '[D|C][V|D]' | cut -d':' -f1") 919 ); 918 sprintf(tmp, "%s", call_program_and_get_last_line_of_output("dvdrecord -scanbus 2> /dev/null | grep -E '\)\ \'' | grep -n '' | grep -E '[D|C][V|D]' | cut -d':' -f1")); 920 919 log_msg(5, "tmp = '%s'", tmp); 921 920 if (!tmp[0]) … … 959 958 #if linux 960 959 unsigned long long s = 0; 961 int fileid, cylinders = 0 , cylindersleft = 0;960 int fileid, cylinders = 0; 962 961 int cylindersize = 0; 963 962 int gotgeo = 0; … … 1008 1007 if (ioctl(fileid, HDIO_GETGEO, &hdgeo) != -1) { 1009 1008 if (hdgeo.cylinders && hdgeo.heads && hdgeo.sectors) { 1010 cylindersleft = cylinders = hdgeo.cylinders;1011 1009 cylindersize = hdgeo.heads * hdgeo.sectors / 2; 1012 1010 outvalA = cylindersize * cylinders / 1024; … … 1056 1054 char *command; 1057 1055 char *format_sz; 1056 char *p; 1058 1057 1059 1058 FILE *pin; … … 1081 1080 } else { 1082 1081 strcpy(good_formats, " "); 1083 (void)fgets(good_formats + 1, MAX_STR_LEN - 1, pin);1084 if (pclose(pin) ) {1082 p = fgets(good_formats + 1, MAX_STR_LEN - 1, pin); 1083 if (pclose(pin) && (p != NULL)) { 1085 1084 log_OS_error("Cannot pclose good formats"); 1086 1085 } … … 1153 1152 return(FALSE); 1154 1153 } 1155 for ( (void)fgets(incoming, MAX_STR_LEN - 1, fin); !feof(fin);1156 (void)fgets(incoming, MAX_STR_LEN - 1, fin)) {1154 for (tmp = fgets(incoming, MAX_STR_LEN - 1, fin); !feof(fin) && (tmp != NULL); 1155 tmp = fgets(incoming, MAX_STR_LEN - 1, fin)) { 1157 1156 if (strstr(incoming, device_with_space) //> incoming 1158 1157 || strstr(incoming, device_with_tab)) // > incoming) … … 2525 2524 if (bkpinfo->disaster_recovery) { 2526 2525 sprintf(command ,"umount %s/isodir 2> /dev/null", bkpinfo->tmpdir); 2527 (void)system(command);2526 paranoid_system(command); 2528 2527 } 2529 2528 strcpy(tmp1, bkpinfo->netfs_proto); … … 2981 2980 /* Before changing remove old ones if any */ 2982 2981 if (bkpinfo->scratchdir) { 2983 chdir("/tmp"); 2982 if (chdir("/tmp")) { 2983 // FIXME 2984 } 2984 2985 mr_asprintf(&tmp1, "rm -Rf %s", bkpinfo->scratchdir); 2985 2986 paranoid_system(tmp1); … … 3190 3191 char *list_drives_cmd = NULL; 3191 3192 char *current_drive; 3193 char *tmp; 3192 3194 3193 3195 /*@ pointers *************************************************** */ … … 3219 3221 mr_free(list_drives_cmd); 3220 3222 3221 for ( (void)fgets(current_drive, MAX_STR_LEN, pdrives); !feof(pdrives);3222 (void)fgets(current_drive, MAX_STR_LEN, pdrives)) {3223 for (tmp = fgets(current_drive, MAX_STR_LEN, pdrives); !feof(pdrives) && (tmp != NULL); 3224 tmp = fgets(current_drive, MAX_STR_LEN, pdrives)) { 3223 3225 strip_spaces(current_drive); 3224 3226 log_it("looking at drive %s's MBR", current_drive); … … 3261 3263 mr_free(list_drives_cmd); 3262 3264 3263 for ( (void)fgets(current_drive, MAX_STR_LEN, pdrives); !feof(pdrives);3264 (void)fgets(current_drive, MAX_STR_LEN, pdrives)) {3265 for (tmp = fgets(current_drive, MAX_STR_LEN, pdrives); !feof(pdrives) && (tmp != NULL); 3266 tmp = fgets(current_drive, MAX_STR_LEN, pdrives)) { 3265 3267 strip_spaces(current_drive); 3266 3268 log_it("looking at partition %s's BR", current_drive);
Note:
See TracChangeset
for help on using the changeset viewer.