Changeset 1139 in MondoRescue
- Timestamp:
- Feb 11, 2007, 7:04:12 PM (18 years ago)
- Location:
- branches/stable/mondo/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/stable/mondo/src/common/libmondo-archive.c
r1138 r1139 1876 1876 g_current_media_number); 1877 1877 mr_msg(1, message_to_screen); 1878 sprintf(result_sz, "Call to mkisofs to make ISO (%s #%d) ",1879 media_descriptor_string(bkpinfo->backup_media_type),1880 g_current_media_number);1878 mr_asprintf(&result_sz, "Call to mkisofs to make ISO (%s #%d) ", 1879 bkpinfo->backup_media_string, 1880 g_current_media_number); 1881 1881 if (bkpinfo->nonbootable_backup) { 1882 1882 mr_msg(1, "Making nonbootable backup"); 1883 res = 1884 eval_call_to_make_ISO(bkpinfo, 1885 "mkisofs -o '_ISO_' -r -p MondoRescue -publisher www.mondorescue.org -A MondoRescue_GPL -V _CD#_ .", 1886 destfile, g_current_media_number, 1887 MONDO_LOGFILE, message_to_screen); 1883 res = eval_call_to_make_ISO(bkpinfo, 1884 "mkisofs -o '_ISO_' -r -p MondoRescue -publisher www.mondorescue.org -A Mondo_Rescue_GPL -V _CD#_ .", 1885 destfile, g_current_media_number, 1886 MONDO_LOGFILE, message_to_screen); 1888 1887 } else { 1889 1888 mr_msg(1, "Making bootable backup"); … … 1940 1939 } 1941 1940 retval += res; 1941 mr_free(result_sz); 1942 1942 } 1943 1943 … … 1948 1948 "Warning - %s mounted. I'm unmounting it before I burn to it.", 1949 1949 bkpinfo->media_device); 1950 sprintf(tmp, "umount %s", bkpinfo->media_device);1950 mr_asprintf(&tmp, "umount %s", bkpinfo->media_device); 1951 1951 run_program_and_log_output(tmp, FALSE); 1952 mr_free(tmp); 1952 1953 } 1953 1954 } … … 1955 1956 if (bkpinfo->call_burn_iso[0] != '\0') { 1956 1957 mr_msg(2, "bkpinfo->call_burn_iso = %s", bkpinfo->call_burn_iso); 1957 sprintf(message_to_screen, "Burning %s #%d",1958 media_descriptor_string(bkpinfo->backup_media_type),1959 g_current_media_number);1958 mr_asprintf(&message_to_screen, "Burning %s #%d", 1959 bkpinfo->backup_media_string, 1960 g_current_media_number); 1960 1961 pause_and_ask_for_cdr(2, &cd_is_mountable); 1961 res = 1962 eval_call_to_make_ISO(bkpinfo, bkpinfo->call_burn_iso, 1963 destfile, g_current_media_number, 1964 MONDO_LOGFILE, message_to_screen); 1962 res = eval_call_to_make_ISO(bkpinfo, bkpinfo->call_burn_iso, 1963 destfile, g_current_media_number, 1964 MONDO_LOGFILE, message_to_screen); 1965 1965 if (res) { 1966 strcat(message_to_screen, "...failed");1966 log_to_screen("%s...failed", message_to_screen); 1967 1967 } else { 1968 strcat(message_to_screen, "...OK");1969 } 1970 log_to_screen(message_to_screen);1968 log_to_screen("%s...OK", message_to_screen); 1969 } 1970 mr_free(message_to_screen); 1971 1971 retval += res; 1972 1972 } 1973 1973 1974 if (bkpinfo->call_after_iso[0] != '\0') { 1975 sprintf(message_to_screen, "Running post-ISO call (%s #%d)", 1976 media_descriptor_string(bkpinfo->backup_media_type), 1977 g_current_media_number); 1978 res = 1979 eval_call_to_make_ISO(bkpinfo, bkpinfo->call_after_iso, 1980 destfile, g_current_media_number, 1981 MONDO_LOGFILE, message_to_screen); 1974 if (bkpinfo->call_after_iso != NULL) { 1975 mr_asprintf(&message_to_screen, "Running post-ISO call (%s #%d)", 1976 bkpinfo->backup_media_string, 1977 g_current_media_number); 1978 res = eval_call_to_make_ISO(bkpinfo, bkpinfo->call_after_iso, 1979 destfile, g_current_media_number, 1980 MONDO_LOGFILE, message_to_screen); 1982 1981 if (res) { 1983 strcat(message_to_screen, "...failed");1982 log_to_screen("%s...failed", message_to_screen); 1984 1983 } else { 1985 strcat(message_to_screen, "...OK");1986 } 1987 log_to_screen(message_to_screen);1984 log_to_screen("%s...OK", message_to_screen); 1985 } 1986 mr_free(message_to_screen); 1988 1987 retval += res; 1989 1988 } … … 1994 1993 } 1995 1994 mr_free(old_pwd); 1996 mr_free(result_sz);1997 mr_free(message_to_screen);1998 mr_free(sz_blank_disk);1999 1995 return (retval); 2000 1996 } … … 2048 2044 /*@ buffers ******************************************** */ 2049 2045 char *tmp; 2050 char *bigfile_fname ;2046 char *bigfile_fname = NULL; 2051 2047 char *sz_devfile; 2052 2048 char *ntfsprog_fifo = NULL; … … 2059 2055 int retval = 0; 2060 2056 int res = 0; 2057 size_t n = 0; 2061 2058 pid_t pid; 2062 2059 FILE *ftmp = NULL; -
branches/stable/mondo/src/common/libmondo-fork.c
r1138 r1139 217 217 } /* single '=' is intentional */ 218 218 219 220 len = (int) strlen(program);221 malloc_string(tmp);222 for (i = 0; i < 35 - len / 2; i++) {223 tmp[i] = '-';224 }225 tmp[i] = '\0';226 strcat(tmp, " ");227 strcat(tmp, program);228 strcat(tmp, " ");229 for (i = 0; i < 35 - len / 2; i++) {230 strcat(tmp, "-");231 }232 mr_free(tmp);233 234 219 res = system(callstr); 235 220 if (((res == 0) && log_if_success) || ((res != 0) && log_if_failure)) { -
branches/stable/mondo/src/test/mktest
r1104 r1139 6 6 # 7 7 8 lib="../lib/mr_conf.c ../lib/mr_msg.c ../lib/mr_err.c ../lib/mr_mem.c "9 OPT="-Wall -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_REENTRANT -Wstrict-prototypes -Wshadow -funsigned-char -Wunused -W init-self -Wcast-align -fno-strict-aliasing -O2 -g -I../common -I../include"8 lib="../lib/mr_conf.c ../lib/mr_msg.c ../lib/mr_err.c ../lib/mr_mem.c ../lib/mr_str.c ../lib/mr_file.c" 9 OPT="-Wall -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_REENTRANT -Wstrict-prototypes -Wshadow -funsigned-char -Wunused -Wcast-align -fno-strict-aliasing -O2 -g -I../common -I../include" 10 10 11 echo "Generating test-msg" 12 gcc $OPT test-msg.c $lib -o test-msg 13 echo "Generating test-string" 14 gcc $OPT test-string.c ../lib/mr_str.c $lib -o test-string 15 echo "Generating test-conf" 16 gcc $OPT test-conf.c $lib -o test-conf 17 echo "Generating test-mem" 18 gcc $OPT test-mem.c $lib -o test-mem 11 prg="test-conf test-string test-msg test-mem" 12 13 for i in $prg ; do 14 echo "Generating $i" 15 gcc $OPT $i.c $lib -o $i 16 done 19 17 20 18 echo "Testing against previous run" 21 for f in test-conf test-string test-msg test-mem; do19 for f in $prg ; do 22 20 chmod 755 $f 23 21 ./$f > /tmp/$f.res … … 28 26 echo "$f test OK" 29 27 fi 28 done 29 for f in $prg ; do 30 30 valgrind -q --error-exitcode=1 --leak-check=yes ./$f 2>&1 > /tmp/valgrind-$f.res 31 31 if [ $? -ne 0 ]; then -
branches/stable/mondo/src/test/test-mem.c
r1105 r1139 1 #include <mr_mem.h>2 1 #include <stdio.h> 3 2 #include <stdlib.h> 4 3 #include <assert.h> 5 4 5 #include "mr_mem.h" 6 #include "mr_file.h" 7 6 8 void is_null(const char* str) 7 9 { 8 9 10 11 10 if (str == NULL) 11 printf("pointer is null\n"); 12 else 13 printf("pointer is NOT null\n"); 12 14 } 13 15 14 16 int main(void) 15 17 { 16 char* str = NULL; 18 char* str = NULL; 19 FILE *fd = NULL; 20 size_t n = 0; 17 21 18 printf("*** Test withmr_free\n");19 20 21 22 22 printf("*** Test with mr_malloc/mr_free\n"); 23 str = mr_malloc(10); 24 is_null(str); 25 mr_free(str); 26 is_null(str); 23 27 24 printf("*** Test with NULL\n"); 25 str = NULL; 26 is_null(str); 27 mr_free(str); 28 is_null(str); 28 printf("*** Test with mr_asprintf/mr_free\n"); 29 mr_asprintf(&str,"Chain %s","of trust"); 30 printf("Result: %s\n",str); 31 mr_free(str); 29 32 30 return 0; 33 printf("*** Test with mr_getline/mr_free\n"); 34 fd = mr_fopen("/etc/passwd","r"); 35 mr_getline(&str,&n,fd); 36 printf("1st Result: %s",str); 37 mr_getline(&str,&n,fd); 38 printf("2nd Result: %s",str); 39 mr_free(str); 40 41 printf("*** Test with NULL\n"); 42 str = NULL; 43 is_null(str); 44 mr_free(str); 45 is_null(str); 46 47 return 0; 31 48 } 32 49
Note:
See TracChangeset
for help on using the changeset viewer.