Changeset 2420 in MondoRescue for branches/2.2.10/mondo/src/common/libmondo-fork.c
- Timestamp:
- Sep 24, 2009, 11:48:15 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2.10/mondo/src/common/libmondo-fork.c
r2405 r2420 38 38 /*@ buffers ***************************************************** */ 39 39 char *result = NULL; 40 char * p= NULL;40 char *tmpf = NULL; 41 41 42 42 /*@ pointers **************************************************** */ … … 47 47 assert_string_is_neither_NULL_nor_zerolength(call); 48 48 49 mr_asprintf(tmpf, "%s/cpgll.out", bkpinfo->scratchdir); 50 mr_strcat(call, " > %s", tmpf); 49 51 log_msg(4, "Calling command: %s", call); 50 52 /* By default return an empty string in any case */ 51 53 mr_asprintf(result, ""); 52 54 53 /* popen seems to always return an empty line after the interesting last line result */54 if ((fin = popen(call, "r"))) {55 system(call); 56 if ((fin = fopen(ftmp, "r"))) { 55 57 while (!feof(fin)) { 56 mr_getline(p, fin); 57 log_msg(9, "p: %s", p); 58 if ((p != NULL) && (strlen(p) > 1)) { 59 mr_free(result); 60 mr_asprintf(result, "%s", p); 61 log_msg(9, "Result: %s", result); 62 } 63 mr_free(p); 64 } 65 log_msg(4, "Result: %s", result); 58 mr_getline(result, fin); 59 log_msg(9, "Loop result: %s", result); 60 } 61 log_msg(4, "Final Result: %s", result); 66 62 mr_strip_spaces(result); 67 63 paranoid_pclose(fin); … … 69 65 log_OS_error("Unable to popen call"); 70 66 } 67 mr_free(ftmp) 71 68 log_msg(4, "Returns: %s", result); 72 69 return(result);
Note:
See TracChangeset
for help on using the changeset viewer.