Changeset 1173 in MondoRescue for branches/stable/mondo/src/common/libmondo-files.c
- Timestamp:
- Feb 16, 2007, 12:25:24 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/stable/mondo/src/common/libmondo-files.c
r1158 r1173 83 83 return (output); 84 84 } 85 86 87 /**88 * Get a not-quite-unique representation of some of the file's @c stat properties.89 * The returned string has the form <tt>size-mtime-ctime</tt>.90 * @param curr_fname The file to generate the "checksum" for.91 * @return The "checksum".92 * @note The returned string points to static storage that will be overwritten with each call.93 */94 char *calc_file_ugly_minichecksum(char *curr_fname)95 {96 97 /*@ buffers ***************************************************** */98 static char curr_cksum[1000];99 100 /*@ pointers **************************************************** */101 102 /*@ structures ************************************************** */103 struct stat buf;104 105 /*@ initialize data *************************************************** */106 curr_cksum[0] = '\0';107 108 /*@************************************************************** */109 110 assert_string_is_neither_NULL_nor_zerolength(curr_fname);111 if (lstat(curr_fname, &buf)) {112 return (curr_cksum); // empty113 }114 115 sprintf(curr_cksum, "%ld-%ld-%ld", (long) (buf.st_size),116 (long) (buf.st_mtime), (long) (buf.st_ctime));117 return (curr_cksum);118 }119 120 85 121 86 … … 699 664 long file_len_K = 0L; 700 665 701 malloc_string(sz_res);702 666 mr_asprintf(&command, 703 667 "grep '%s ' %s/mountlist.txt | head -n1 | awk '{print $4;}'", 704 668 dev, tmpdir); 705 669 log_it(command); 706 strcpy(sz_res, call_program_and_get_last_line_of_output(command));670 mr_asprintf(&sz_res, call_program_and_get_last_line_of_output(command)); 707 671 file_len_K = atol(sz_res); 708 672 mr_msg(4, "%s --> %s --> %ld", command, sz_res, file_len_K); … … 982 946 /*@ Char buffers ** */ 983 947 char *command = NULL; 984 char tmp[MAX_STR_LEN];948 char *tmp = NULL; 985 949 char old_pwd[MAX_STR_LEN]; 986 950 … … 1008 972 mr_free(command); 1009 973 1010 sprintf(tmp, "%s/payload.tgz", g_mondo_home);974 mr_asprintf(&tmp, "%s/payload.tgz", g_mondo_home); 1011 975 if (does_file_exist(tmp)) { 1012 976 log_it("Untarring payload %s to scratchdir %s", tmp, … … 1021 985 chdir(old_pwd); 1022 986 } 987 mr_free(tmp); 1023 988 1024 989 mr_asprintf(&command, "cp -f %s/LAST-FILELIST-NUMBER %s", bkpinfo->tmpdir, 1025 990 bkpinfo->scratchdir); 1026 1027 991 if (run_program_and_log_output(command, FALSE)) { 1028 992 fatal_error("Failed to copy LAST-FILELIST-NUMBER to scratchdir"); … … 1030 994 mr_free(command); 1031 995 1032 strcpy(tmp,call_program_and_get_last_line_of_output("which mondorestore"));996 mr_asprintf(&tmp,call_program_and_get_last_line_of_output("which mondorestore")); 1033 997 if (!tmp) { 1034 998 fatal_error … … 1036 1000 } 1037 1001 mr_asprintf(&command, "cp -f %s %s", tmp, bkpinfo->tmpdir); 1002 mr_free(tmp); 1003 1038 1004 if (run_program_and_log_output(command, FALSE)) { 1039 1005 fatal_error("Failed to copy mondorestore to tmpdir"); … … 1267 1233 *(strchr(tmp, ' ')) = '\0'; 1268 1234 } 1269 if (!strcmp(strrchr(filename, '.'), tmp)) {1235 if (!strcmp(strrchr(filename, '.'), tmp)) { 1270 1236 mr_free(do_not_compress_these); 1271 1237 mr_free(tmp);
Note:
See TracChangeset
for help on using the changeset viewer.