Changeset 3352 in MondoRescue for branches/3.2/mondo/src
- Timestamp:
- Mar 3, 2015, 1:21:55 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3.2/mondo/src/common/libmondo-devices.c
r3350 r3352 868 868 int find_dvd_device(char *output, bool try_to_mount) 869 869 { 870 char *tmp ;870 char *tmp = NULL; 871 871 int retval = 0, devno = -1; 872 872 … … 877 877 } 878 878 879 malloc_string(tmp);880 879 mr_asprintf(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")); 881 880 log_msg(5, "tmp = '%s'", tmp); … … 901 900 return (retval); 902 901 } 903 904 905 906 902 907 903 … … 2872 2868 void make_fifo(char *store_name_here, char *stub) 2873 2869 { 2874 char *tmp; 2875 2876 malloc_string(tmp); 2870 char *tmp = NULL; 2871 2877 2872 assert_string_is_neither_NULL_nor_zerolength(stub); 2878 2873 … … 2881 2876 make_hole_for_file(store_name_here); 2882 2877 mkfifo(store_name_here, S_IRWXU | S_IRWXG); 2883 sprintf(tmp, "chmod 770 %s", store_name_here);2878 mr_asprintf(tmp, "chmod 770 %s", store_name_here); 2884 2879 paranoid_system(tmp); 2885 paranoid_free(tmp);2880 mr_free(tmp); 2886 2881 } 2887 2882 … … 2901 2896 bool set_dev_to_this_if_rx_OK(char *output, char *dev) 2902 2897 { 2903 char *command ;2904 2905 malloc_string(command); 2898 char *command = NULL; 2899 bool ret=FALSE; 2900 2906 2901 if (!dev || dev[0] == '\0') { 2907 2902 output[0] = '\0'; 2908 return (FALSE);2903 return(ret); 2909 2904 } 2910 2905 // assert_string_is_neither_NULL_nor_zerolength(dev); … … 2915 2910 if (!does_file_exist(dev)) { 2916 2911 log_msg(10, "%s doesn't exist. Returning FALSE.", dev); 2917 return (FALSE); 2918 } 2919 sprintf(command, "dd bs=%ld count=1 if=%s of=/dev/null &> /dev/null", 2920 512L, dev); 2921 if (!run_program_and_log_output(command, FALSE) 2922 && !run_program_and_log_output(command, FALSE)) { 2912 return(ret); 2913 } 2914 mr_asprintf(command, "dd bs=%ld count=1 if=%s of=/dev/null &> /dev/null", 512L, dev); 2915 if (!run_program_and_log_output(command, FALSE) && !run_program_and_log_output(command, FALSE)) { 2923 2916 strcpy(output, dev); 2924 2917 log_msg(4, "Found it - %s", dev); 2925 ret urn (TRUE);2918 ret = TRUE; 2926 2919 } else { 2927 2920 output[0] = '\0'; 2928 2921 log_msg(4, "It's not %s", dev); 2929 return (FALSE); 2930 } 2922 } 2923 mr_free(command); 2924 return(ret); 2931 2925 } 2932 2926 … … 2979 2973 return (cd_number); 2980 2974 } 2981 2982 2983 2984 2985 2986 2975 2987 2976 … … 3218 3207 { 3219 3208 static char output[MAX_STR_LEN]; 3220 char *command ;3221 char *curr_fname ;3209 char *command = NULL; 3210 char *curr_fname = NULL; 3222 3211 char *scratch = NULL; 3223 3212 char *tmp = NULL; … … 3225 3214 3226 3215 struct stat statbuf; 3227 command = malloc(1000);3228 3216 malloc_string(curr_fname); 3229 3217 if (!does_file_exist(incoming)) { … … 3236 3224 while (S_ISLNK(statbuf.st_mode)) { 3237 3225 log_msg(1, "curr_fname = %s", curr_fname); 3238 sprintf(command, "file %s", curr_fname);3226 mr_asprintf(command, "file %s", curr_fname); 3239 3227 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command)); 3228 mr_free(command); 3240 3229 for (p = tmp + strlen(tmp); p != tmp && *p != '`' && *p != ' '; 3241 3230 p--); … … 3265 3254 log_it("resolved %s to %s", incoming, output); 3266 3255 } 3267 paranoid_free(command);3268 3256 paranoid_free(curr_fname); 3269 3257 return (output); … … 3279 3267 char *output = NULL; 3280 3268 char *tmp = NULL; 3281 char *command; 3282 char *fdisk; 3269 char *command = NULL; 3283 3270 #ifdef __IA64__ 3284 3271 struct stat buf; 3285 3272 #endif 3286 malloc_string(command); 3287 malloc_string(fdisk); 3288 sprintf(fdisk, "/sbin/parted2fdisk"); 3289 sprintf(command, "%s -l %s 2>/dev/null | grep 'EFI GPT'", fdisk, drive); 3273 mr_asprintf(command, "parted2fdisk -l %s 2>/dev/null | grep 'EFI GPT'", drive); 3290 3274 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command)); 3275 mr_free(command); 3276 3291 3277 if (strstr(tmp, "GPT") == NULL) { 3292 3278 mr_asprintf(output, "%s", "MBR"); … … 3297 3283 3298 3284 log_msg(0, "Found %s partition table format type on %s", output, drive); 3299 paranoid_free(command);3300 paranoid_free(fdisk);3301 3285 return (output); 3302 3286 }
Note:
See TracChangeset
for help on using the changeset viewer.