Changeset 3060 in MondoRescue for branches/3.0/mondo/src/common/libmondo-fork.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-fork.c
r3042 r3060 39 39 static char result[MAX_STR_LEN]; 40 40 char *tmp; 41 char *p; 41 42 42 43 /*@ pointers **************************************************** */ … … 52 53 assert_string_is_neither_NULL_nor_zerolength(call); 53 54 if ((fin = popen(call, "r"))) { 54 for ( fgets(tmp, MAX_STR_LEN, fin); !feof(fin);55 fgets(tmp, MAX_STR_LEN, fin)) {55 for (p = fgets(tmp, MAX_STR_LEN, fin); !feof(fin) && (p != NULL); 56 p = fgets(tmp, MAX_STR_LEN, fin)) { 56 57 if (strlen(tmp) > 1) { 57 58 strcpy(result, tmp); … … 267 268 FILE *fin; 268 269 char *p; 270 char *q; 269 271 270 272 /*@ end vars *************************************************** */ … … 312 314 fin = fopen(tmp1, "r"); 313 315 if (fin) { 314 for ( fgets(incoming, MAX_STR_LEN, fin); !feof(fin);fgets(incoming, MAX_STR_LEN, fin)) {316 for (q = fgets(incoming, MAX_STR_LEN, fin); !feof(fin) && (q != NULL); q = fgets(incoming, MAX_STR_LEN, fin)) { 315 317 p = incoming; 316 318 while (p && *p) { … … 562 564 log_msg(1, "bytes_read_in = %ld", bytes_read_in); 563 565 // if (bytes_read_in!=128+64) { fatal_error("Can't read the terminating block"); } 564 fwrite(tmp, 1, bytes_read_in, ftmp); 566 if (fwrite(tmp, 1, bytes_read_in, ftmp)) { 567 fatal_error("Can't fwrite here"); 568 } 565 569 sprintf(tmp, "I am here - %lld", (long long)ftello(fin)); 566 570 // log_msg(0, tmp); 567 fread(tmp, 1, tmpcap, fin); 571 if (fread(tmp, 1, tmpcap, fin)) { 572 fatal_error("Can't fread here"); 573 } 568 574 log_msg(0, "tmp = '%s'", tmp); 569 fwrite(tmp, 1, tmpcap, ftmp); 575 if (fwrite(tmp, 1, tmpcap, ftmp)) { 576 fatal_error("Can't fwrite there"); 577 } 570 578 fclose(ftmp); 571 579 fatal_error("Missing terminating block");
Note:
See TracChangeset
for help on using the changeset viewer.