Changeset 1120 in MondoRescue
- Timestamp:
- Feb 9, 2007, 8:09:40 AM (18 years ago)
- Location:
- branches/stable/mondo/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/stable/mondo/src/common/libmondo-devices.c
r1116 r1120 14 14 #include "libmondo-string-EXT.h" 15 15 #include "libmondo-tools-EXT.h" 16 #include " libmondo-gui-EXT.h"16 #include "newt-specific-EXT.h" 17 17 #include "libmondo-fork-EXT.h" 18 18 #include "libmondo-stream-EXT.h" 19 19 #include "mr_mem.h" 20 21 #include <sys/ioctl.h> 20 22 #include <sys/types.h> 23 #include <unistd.h> 21 24 #ifdef __FreeBSD__ 22 25 #define DKTYPENAMES … … 100 103 bool am_I_in_disaster_recovery_mode(void) 101 104 { 102 char *tmp, *comment; 105 char *tmp = NULL; 106 char *comment = NULL; 103 107 bool is_this_a_ramdisk = FALSE; 104 108 105 malloc_string(tmp); 106 malloc_string(comment); 107 strcpy(tmp, where_is_root_mounted()); 108 sprintf(comment, "root is mounted at %s\n", tmp); 109 mr_asprintf(&tmp, where_is_root_mounted()); 110 mr_asprintf(&comment, "root is mounted at %s\n", tmp); 109 111 mr_msg(0, comment); 112 mr_free(comment); 113 110 114 mr_msg(0, 111 115 "No, Schlomo, that doesn't mean %s is the root partition. It's just a debugging message. Relax. It's part of am_I_in_disaster_recovery_mode().", … … 126 130 } 127 131 #endif 132 mr_free(tmp); 128 133 129 134 if (is_this_a_ramdisk) { … … 131 136 && !does_file_exist("/tmp/mountlist.txt.sample")) { 132 137 log_to_screen 133 ( "Using /dev/root is stupid of you but I'll forgive you.");138 (_("Using /dev/root is stupid of you but I'll forgive you.")); 134 139 is_this_a_ramdisk = FALSE; 135 140 } … … 138 143 is_this_a_ramdisk = TRUE; 139 144 } 140 mr_free(tmp);141 mr_free(comment);142 145 mr_msg(1, "Is this a ramdisk? result = %d", is_this_a_ramdisk); 143 146 return (is_this_a_ramdisk); 144 147 } 145 146 147 148 148 149 149 … … 182 182 strcpy(output, "udev"); 183 183 break; 184 case usb: 185 strcpy(output, "usb"); 186 break; 184 187 default: 185 188 strcpy(output, "default"); … … 187 190 return (output); 188 191 } 189 190 192 191 193 … … 201 203 int eject_device(char *dev) 202 204 { 203 char *command ;205 char *command = NULL; 204 206 int res1 = 0, res2 = 0; 205 206 malloc_string(command);207 207 208 208 if (IS_THIS_A_STREAMING_BACKUP(g_backup_media_type) 209 209 && g_backup_media_type != udev) { 210 sprintf(command, "mt -f %s offline", dev);210 mr_asprintf(&command, "mt -f %s offline", dev); 211 211 res1 = run_program_and_log_output(command, 1); 212 mr_free(command); 212 213 } else { 213 214 res1 = 0; … … 216 217 #ifdef __FreeBSD__ 217 218 if (strstr(dev, "acd")) { 218 sprintf(command, "cdcontrol -f %s eject", dev);219 } else { 220 sprintf(command, "camcontrol eject `echo %s | sed 's|/dev/||'`",219 mr_asprintf(&command, "cdcontrol -f %s eject", dev); 220 } else { 221 mr_asprintf(&command, "camcontrol eject `echo %s | sed 's|/dev/||'`", 221 222 dev); 222 223 } 223 224 #else 224 sprintf(command, "eject %s", dev);225 mr_asprintf(&command, "eject %s", dev); 225 226 #endif 226 227 … … 235 236 } 236 237 238 237 239 /** 238 240 * Load (inject) the tray of the specified CD device. … … 242 244 int inject_device(char *dev) 243 245 { 244 char *command ;246 char *command = NULL; 245 247 int i; 246 247 malloc_string(command);248 249 248 250 249 #ifdef __FreeBSD__ 251 250 if (strstr(dev, "acd")) { 252 sprintf(command, "cdcontrol -f %s close", dev);253 } else { 254 sprintf(command, "camcontrol load `echo %s | sed 's|/dev/||'`",251 mr_asprintf(&command, "cdcontrol -f %s close", dev); 252 } else { 253 mr_asprintf(&command, "camcontrol load `echo %s | sed 's|/dev/||'`", 255 254 dev); 256 255 } 257 256 #else 258 sprintf(command, "eject -t %s", dev);257 mr_asprintf(&command, "eject -t %s", dev); 259 258 #endif 260 259 i = run_program_and_log_output(command, FALSE); … … 273 272 274 273 /*@ buffers *********************************************************** */ 275 char *tmp; 276 bool ret; 277 278 malloc_string(tmp); 274 char *tmp = NULL; 275 bool ret = FALSE; 276 279 277 assert_string_is_neither_NULL_nor_zerolength(device); 280 278 281 sprintf(tmp, "ls %s > /dev/null 2> /dev/null", device);279 mr_asprintf(&tmp, "ls %s > /dev/null 2> /dev/null", device); 282 280 283 281 if (system(tmp)) { … … 287 285 } 288 286 mr_free(tmp); 289 return 287 return(ret); 290 288 } 291 289 … … 318 316 /*@ buffers **************************************************** */ 319 317 char *program; 320 char *incoming ;318 char *incoming = NULL; 321 319 char *searchstr; 322 char *tmp ;320 char *tmp = NULL; 323 321 324 322 /*@ ints ******************************************************* */ 325 323 int res = 0; 324 size_t n = 0; 326 325 327 326 /*@ pointers *************************************************** */ … … 333 332 assert(partno >= 0 && partno < 999); 334 333 335 malloc_string(program);336 334 malloc_string(incoming); 337 335 malloc_string(searchstr); … … 340 338 #ifdef __FreeBSD__ 341 339 // We assume here that this is running from mondorestore. (It is.) 342 sprintf(program, "ls %s >/dev/null 2>&1", drive, 340 // BERLIOS: This is BROKEN - 1 %s - 2 params !! 341 mr_asprintf(&program, "ls %s >/dev/null 2>&1", drive, 343 342 build_partition_name(tmp, drive, partno)); 344 343 return system(program); -
branches/stable/mondo/src/common/libmondo-files.c
r1114 r1120 18 18 #include "libmondo-fork-EXT.h" 19 19 #include "libmondo-string-EXT.h" 20 20 21 #include "mr_mem.h" 21 22 #include "mr_msg.h" 22 23 #include "mr_file.h" 23 24 … … 1265 1266 *(strchr(tmp, ' ')) = '\0'; 1266 1267 } 1267 if (!strcmp(s z_last_suffix(filename), tmp)) {1268 if (!strcmp(strrchr(filename,'.'), tmp)) { 1268 1269 mr_free(do_not_compress_these); 1269 1270 mr_free(tmp); -
branches/stable/mondo/src/mondoarchive/mondo-cli.c
r1108 r1120 16 16 #include "../common/libmondo.h" 17 17 #include "mr_mem.h" 18 #include "mr_msg.h" 18 19 19 20 //static char cvsid[] = "$Id$";
Note:
See TracChangeset
for help on using the changeset viewer.