source: MondoRescue/branches/2.2.10/mondo/src/common/libmondo-fork.c@ 2420

Last change on this file since 2420 was 2420, checked in by Bruno Cornec, 15 years ago
  • star only supports ACL when used with exustar mode. Fix #356.
  • Modify getfattr call to have all extended attributes, including non user ones. (patch from Kevin Ritzenthaler Kevin.Ritzenthaler_at_hp.com) and fix #357

(Backport from 2.2.9)

  • Property svn:keywords set to Id
File size: 18.5 KB
Line 
1/* libmondo-fork.c
2 $Id: libmondo-fork.c 2420 2009-09-24 09:48:15Z bruno $
3
4- subroutines for handling forking/pthreads/etc.
5*/
6
7
8#include "my-stuff.h"
9#include "mr_mem.h"
10#include "mondostructures.h"
11#include "libmondo-fork.h"
12#include "libmondo-string-EXT.h"
13#include "libmondo-gui-EXT.h"
14#include "libmondo-files-EXT.h"
15#include "libmondo-tools-EXT.h"
16#include "lib-common-externs.h"
17
18/*@unused@*/
19//static char cvsid[] = "$Id: libmondo-fork.c 2420 2009-09-24 09:48:15Z bruno $";
20
21extern t_bkptype g_backup_media_type;
22extern bool g_text_mode;
23extern char *MONDO_LOGFILE;
24
25/* Reference to global bkpinfo */
26extern struct s_bkpinfo *bkpinfo;
27pid_t g_buffer_pid = 0;
28
29
30/**
31 * Call a program and retrieve its last line of output.
32 * @param call The program to run.
33 * @return The last line of its output.
34 * @note The returned value points to an allocated string that the caller needs to free
35 */
36char *call_program_and_get_last_line_of_output(char *call)
37{
38 /*@ buffers ***************************************************** */
39 char *result = NULL;
40 char *tmpf = NULL;
41
42 /*@ pointers **************************************************** */
43 FILE *fin;
44
45 /*@******************************************************************** */
46
47 assert_string_is_neither_NULL_nor_zerolength(call);
48
49 mr_asprintf(tmpf, "%s/cpgll.out", bkpinfo->scratchdir);
50 mr_strcat(call, " > %s", tmpf);
51 log_msg(4, "Calling command: %s", call);
52 /* By default return an empty string in any case */
53 mr_asprintf(result, "");
54
55 system(call);
56 if ((fin = fopen(ftmp, "r"))) {
57 while (!feof(fin)) {
58 mr_getline(result, fin);
59 log_msg(9, "Loop result: %s", result);
60 }
61 log_msg(4, "Final Result: %s", result);
62 mr_strip_spaces(result);
63 paranoid_pclose(fin);
64 } else {
65 log_OS_error("Unable to popen call");
66 }
67 mr_free(ftmp)
68 log_msg(4, "Returns: %s", result);
69 return(result);
70}
71
72
73
74
75
76
77#define MONDO_POPMSG "Your PC will not retract the CD tray automatically. Please call mondoarchive with the -m (manual CD tray) flag."
78
79/**
80 * Call mkisofs to create an ISO image.
81 * @param bkpinfo The backup information structure. Fields used:
82 * - @c bkpinfo->manual_cd_tray
83 * - @c bkpinfo->backup_media_type
84 * - @c bkpinfo->please_dont_eject_when_restoring
85 * @param basic_call The call to mkisofs. May contain tokens that will be resolved to actual data. The tokens are:
86 * - @c _ISO_ will become the ISO file (@p isofile)
87 * - @c _CD#_ becomes the CD number (@p cd_no)
88 * - @c _ERR_ becomes the logfile (@p g_logfile)
89 * @param isofile Replaces @c _ISO_ in @p basic_call. Should probably be the ISO image to create (-o parameter to mkisofs).
90 * @param cd_no Replaces @c _CD#_ in @p basic_call. Should probably be the CD number.
91 * @param what_i_am_doing The action taking place (e.g. "Making ISO #1"). Used as the title of the progress dialog.
92 * @return Exit code of @c mkisofs (0 is success, anything else indicates failure).
93 */
94int eval_call_to_make_ISO(char *basic_call, char *isofile, int cd_no, char *what_i_am_doing) {
95
96 /*@ int's *** */
97 int retval = 0;
98
99
100 /*@ buffers *** */
101 char *midway_call = NULL;
102 char *ultimate_call = NULL;
103 char *tmp = NULL;
104
105 char *cd_number_str = NULL;
106 char *command = NULL;
107 char *p;
108 char *tmp1 = NULL;
109 char *tmp2 = NULL;
110
111/*@*********** End Variables ***************************************/
112
113 log_msg(3, "Starting");
114 assert(bkpinfo != NULL);
115 assert_string_is_neither_NULL_nor_zerolength(isofile);
116
117 if ((bkpinfo->netfs_user) && (strstr(bkpinfo->netfs_proto,"nfs"))) {
118 mr_asprintf(tmp1, "su - %s -c \"%s\"", bkpinfo->netfs_user, basic_call);
119 } else {
120 mr_asprintf(tmp1, "%s", basic_call);
121 }
122
123 mr_asprintf(cd_number_str, "%d", cd_no);
124 log_msg(4, "basic call = '%s'", tmp1);
125 midway_call = resolve_naff_tokens(tmp1, isofile, "_ISO_");
126 mr_free(tmp1);
127
128 log_msg(4, "midway_call = '%s'", midway_call);
129 tmp = resolve_naff_tokens(midway_call, cd_number_str, "_CD#_");
130 mr_free(cd_number_str);
131 mr_free(midway_call);
132
133 log_msg(4, "tmp = '%s'", tmp);
134 ultimate_call = resolve_naff_tokens(tmp, MONDO_LOGFILE, "_ERR_");
135 mr_free(tmp);
136
137 log_msg(4, "ultimate call = '%s'", ultimate_call);
138 mr_asprintf(command, "%s >> %s", ultimate_call, MONDO_LOGFILE);
139 mr_free(ultimate_call);
140
141 log_to_screen
142 ("Please be patient. Do not be alarmed by on-screen inactivity.");
143 log_msg(4, "Calling open_evalcall_form() with what_i_am_doing='%s'",
144 what_i_am_doing);
145 if (bkpinfo->manual_cd_tray) {
146 mr_asprintf(tmp2, "%s", command);
147 p = strstr(tmp2, "2>>");
148 if (p) {
149 *p++ = ' ';
150 *p++ = ' ';
151 *p++ = ' ';
152 while (*p == ' ') {
153 p++;
154 }
155 for (; (*p != ' ') && (*p != '\0'); p++) {
156 *p = ' ';
157 }
158 }
159 mr_free(command);
160 command = tmp2;
161 if (!g_text_mode) {
162 newtSuspend();
163 }
164 log_msg(1, "command = '%s'", command);
165 retval += system(command);
166 if (!g_text_mode) {
167 newtResume();
168 }
169 if (retval) {
170 popup_and_OK("mkisofs and/or cdrecord returned an error. CD was not created");
171 }
172 }
173 /* if text mode then do the above & RETURN; if not text mode, do this... */
174 else {
175 log_msg(3, "command = '%s'", command);
176 retval = run_external_binary_with_percentage_indicator_NEW(what_i_am_doing, command);
177 }
178 mr_free(command);
179 return (retval);
180}
181
182
183/**
184 * Call copy of data to create an USB image.
185 * @param bkpinfo The backup information structure. Fields used:
186 * - @c bkpinfo->backup_media_type
187 * @return Exit code of @c copy (0 is success, anything else indicates failure).
188 */
189int
190eval_call_to_make_USB(char *command, char *what_i_am_doing) {
191
192 /*@ int's *** */
193 int retval = 0;
194
195
196/*@*********** End Variables ***************************************/
197
198 log_msg(3, "Starting");
199 assert(bkpinfo != NULL);
200
201 log_to_screen
202 ("Please be patient. Do not be alarmed by on-screen inactivity.");
203 log_msg(4, "Calling open_evalcall_form() with what_i_am_doing='%s'",
204 what_i_am_doing);
205
206 if (!g_text_mode) {
207 newtSuspend();
208 }
209 log_msg(1, "command = '%s'", command);
210 if (!g_text_mode) {
211 retval = run_external_binary_with_percentage_indicator_NEW(what_i_am_doing, command);
212 } else {
213 retval += system(command);
214 }
215 if (!g_text_mode) {
216 newtResume();
217 }
218
219 return (retval);
220}
221
222
223
224
225/**
226 * Run a program and log its output (stdout and stderr) to the logfile.
227 * @param program The program to run. Passed to the shell, so you can use pipes etc.
228 * @param debug_level If @p g_loglevel is higher than this, do not log the output.
229 * @return The exit code of @p program (depends on the command, but 0 almost always indicates success).
230 */
231int run_program_and_log_output(char *program, int debug_level)
232{
233 /*@ buffer ****************************************************** */
234 char *callstr = NULL;
235 char incoming[MAX_STR_LEN * 2];
236 char *tmp1 = NULL;
237
238 /*@ int ********************************************************* */
239 int res;
240 bool log_if_failure = FALSE;
241 bool log_if_success = FALSE;
242
243 /*@ pointers *************************************************** */
244 FILE *fin;
245 char *p;
246
247 /*@ end vars *************************************************** */
248
249 assert(program != NULL);
250 if (!program[0]) {
251 log_msg(2, "Warning - asked to run zerolength program");
252 return (1);
253 }
254
255 if (debug_level <= g_loglevel) {
256 log_if_success = TRUE;
257 log_if_failure = TRUE;
258 }
259 mr_asprintf(callstr, "%s > %s/mondo-run-prog-thing.tmp 2> %s/mondo-run-prog-thing.err", program, bkpinfo->tmpdir, bkpinfo->tmpdir);
260 while ((p = strchr(callstr, '\r'))) {
261 *p = ' ';
262 }
263 while ((p = strchr(callstr, '\n'))) {
264 *p = ' ';
265 } /* single '=' is intentional */
266
267
268 res = system(callstr);
269 if (((res == 0) && log_if_success) || ((res != 0) && log_if_failure)) {
270 log_msg(0, "running: %s", callstr);
271 log_msg(0, "--------------------------------start of output-----------------------------");
272 }
273 mr_free(callstr);
274
275 mr_asprintf(callstr, "cat %s/mondo-run-prog-thing.err >> %s/mondo-run-prog-thing.tmp 2> /dev/null", bkpinfo->tmpdir, bkpinfo->tmpdir);
276 if (log_if_failure && system(callstr)) {
277 log_OS_error("Command failed");
278 }
279 mr_free(callstr);
280
281 mr_asprintf(tmp1, "%s/mondo-run-prog-thing.err", bkpinfo->tmpdir);
282 unlink(tmp1);
283 mr_free(tmp1);
284
285 mr_asprintf(tmp1, "%s/mondo-run-prog-thing.tmp", bkpinfo->tmpdir);
286 fin = fopen(tmp1, "r");
287 if (fin) {
288 for (fgets(incoming, MAX_STR_LEN, fin); !feof(fin); fgets(incoming, MAX_STR_LEN, fin)) {
289 p = incoming;
290 while (p && *p) {
291 if ((p = strchr(p, '%'))) {
292 memmove(p, p + 1, strlen(p) + 1);
293 p += 2;
294 }
295 }
296 strip_spaces(incoming);
297 if ((res == 0 && log_if_success) || (res != 0 && log_if_failure)) {
298 log_msg(0, incoming);
299 }
300 }
301 paranoid_fclose(fin);
302 }
303 unlink(tmp1);
304 mr_free(tmp1);
305
306 if ((res == 0 && log_if_success) || (res != 0 && log_if_failure)) {
307 log_msg(0,
308 "--------------------------------end of output------------------------------");
309 if (res) {
310 log_msg(0, "...ran with res=%d", res);
311 } else {
312 log_msg(0, "...ran just fine. :-)");
313 }
314 }
315 return (res);
316}
317
318
319
320/**
321 * Run a program and log its output to the screen.
322 * @param basic_call The program to run.
323 * @param what_i_am_doing The title of the evalcall form.
324 * @return The return value of the command (varies, but 0 almost always means success).
325 * @see run_program_and_log_output
326 * @see log_to_screen
327 */
328int run_program_and_log_to_screen(char *basic_call, char *what_i_am_doing)
329{
330 /*@ int ******************************************************** */
331 int retval = 0;
332 int res = 0;
333 int i;
334
335 /*@ pointers **************************************************** */
336 FILE *fin;
337
338 /*@ buffers **************************************************** */
339 char *command = NULL;
340 char *lockfile = NULL;
341
342 /*@ end vars *************************************************** */
343
344 assert_string_is_neither_NULL_nor_zerolength(basic_call);
345
346 mr_asprintf(lockfile, "%s/mojo-jojo.bla.bla", bkpinfo->tmpdir);
347
348 mr_asprintf(command, "echo hi > %s ; %s >> %s 2>> %s; res=$?; sleep 1; rm -f %s; exit $res", lockfile, basic_call, MONDO_LOGFILE, MONDO_LOGFILE, lockfile);
349 open_evalcall_form(what_i_am_doing);
350 log_msg(2, "Executing %s", basic_call);
351
352 if (!(fin = popen(command, "r"))) {
353 log_OS_error("Unable to popen-in command");
354 log_to_screen("Failed utterly to call '%s'", command);
355 mr_free(command);
356 mr_free(lockfile);
357 return (1);
358 }
359 mr_free(command);
360
361 if (!does_file_exist(lockfile)) {
362 log_to_screen("Waiting for external binary to start");
363 for (i = 0; i < 60 && !does_file_exist(lockfile); sleep(1), i++) {
364 log_msg(3, "Waiting for lockfile %s to exist", lockfile);
365 }
366 }
367
368 for (; does_file_exist(lockfile); sleep(1)) {
369 log_file_end_to_screen(MONDO_LOGFILE, "");
370 update_evalcall_form(1);
371 }
372
373 /* Evaluate the status returned by pclose to get the exit code of the called program. */
374 errno = 0;
375 res = pclose(fin);
376 /* Log actual pclose errors. */
377 if (errno) log_msg(5, "pclose err: %d", errno);
378 /* Check if we have a valid status. If we do, extract the called program's exit code. */
379 /* If we don't, highlight this fact by returning -1. */
380 if (WIFEXITED(res)) {
381 retval = WEXITSTATUS(res);
382 } else {
383 retval = -1;
384 }
385 close_evalcall_form();
386 unlink(lockfile);
387 mr_free(lockfile);
388
389 return (retval);
390}
391
392
393
394
395/**
396 * Apparently unused. @bug This has a purpose, but what?
397 */
398#define PIMP_START_SZ "STARTSTARTSTART9ff3kff9a82gv34r7fghbkaBBC2T231hc81h42vws8"
399#define PIMP_END_SZ "ENDENDEND0xBBC10xBBC2T231hc81h42vws89ff3kff9a82gv34r7fghbka"
400
401
402
403
404int copy_from_src_to_dest(FILE * f_orig, FILE * f_archived, char direction)
405{
406// if dir=='w' then copy from orig to archived
407// if dir=='r' then copy from archived to orig
408 char *tmp = NULL;
409 char *tmp1 = NULL;
410 char *buf = NULL;
411 char *filestr = NULL;
412 long int bytes_to_be_read, bytes_read_in, bytes_written_out =
413 0, bufcap, subsliceno = 0;
414 int retval = 0;
415 FILE *fin;
416 FILE *fout;
417 FILE *ftmp;
418 int tmpcap = 512;
419
420 log_msg(5, "Opening.");
421
422 bufcap = 256L * 1024L;
423 if (!(buf = malloc(bufcap))) {
424 fatal_error("Failed to malloc() buf");
425 }
426
427 if (direction == 'w') {
428 fin = f_orig;
429 fout = f_archived;
430 mr_asprintf(tmp, "%-64s", PIMP_START_SZ);
431 if (fwrite(tmp, 1, 64, fout) != 64) {
432 mr_free(tmp);
433 fatal_error("Can't write the introductory block");
434 }
435 mr_free(tmp);
436
437 while (1) {
438 bytes_to_be_read = bytes_read_in = fread(buf, 1, bufcap, fin);
439 if (bytes_read_in == 0) {
440 break;
441 }
442 mr_asprintf(tmp, "%-64ld", bytes_read_in);
443 if (fwrite(tmp, 1, 64, fout) != 64) {
444 mr_free(tmp);
445 fatal_error("Cannot write introductory block");
446 }
447 mr_free(tmp);
448
449 log_msg(7,
450 "subslice #%ld --- I have read %ld of %ld bytes in from f_orig",
451 subsliceno, bytes_read_in, bytes_to_be_read);
452 bytes_written_out += fwrite(buf, 1, bytes_read_in, fout);
453 mr_asprintf(tmp, "%-64ld", subsliceno);
454 if (fwrite(tmp, 1, 64, fout) != 64) {
455 mr_free(tmp);
456 fatal_error("Cannot write post-thingy block");
457 }
458 mr_free(tmp);
459 log_msg(7, "Subslice #%d written OK", subsliceno);
460 subsliceno++;
461 }
462 mr_asprintf(tmp, "%-64ld", 0L);
463 if (fwrite(tmp, 1, 64L, fout) != 64L) {
464 mr_free(tmp);
465 fatal_error("Cannot write final introductory block");
466 }
467 mr_free(tmp);
468
469 mr_asprintf(tmp, "%-64s", PIMP_END_SZ);
470 if (fwrite(tmp, 1, 64, fout) != 64) {
471 mr_free(tmp);
472 fatal_error("Can't write the final block");
473 }
474 mr_free(tmp);
475 } else {
476 fin = f_archived;
477 fout = f_orig;
478 if (!(tmp1 = malloc(tmpcap))) {
479 fatal_error("Failed to malloc() tmp");
480 }
481 if (fread(tmp1, 1, 64L, fin) != 64L) {
482 mr_free(tmp1);
483 fatal_error("Cannot read the introductory block");
484 }
485 log_msg(5, "tmp1 is %s", tmp1);
486 if (!strstr(tmp1, PIMP_START_SZ)) {
487 mr_free(tmp1);
488 fatal_error("Can't find intro blk");
489 }
490 if (fread(tmp1, 1, 64L, fin) != 64L) {
491 mr_free(tmp1);
492 fatal_error("Cannot read introductory blk");
493 }
494 bytes_to_be_read = atol(tmp1);
495 while (bytes_to_be_read > 0) {
496 log_msg(7, "subslice#%ld, bytes=%ld", subsliceno, bytes_to_be_read);
497 bytes_read_in = fread(buf, 1, bytes_to_be_read, fin);
498 if (bytes_read_in != bytes_to_be_read) {
499 mr_free(tmp1);
500 fatal_error("Danger, WIll Robinson. Failed to read whole subvol from archives.");
501 }
502 bytes_written_out += fwrite(buf, 1, bytes_read_in, fout);
503 if (fread(tmp1, 1, 64, fin) != 64) {
504 mr_free(tmp1);
505 fatal_error("Cannot read post-thingy block");
506 }
507 if (atol(tmp1) != subsliceno) {
508 log_msg(1, "Wanted subslice %ld but got %ld ('%s')", subsliceno, atol(tmp1), tmp1);
509 }
510 log_msg(7, "Subslice #%ld read OK", subsliceno);
511 subsliceno++;
512 if (fread(tmp1, 1, 64, fin) != 64) {
513 mr_free(tmp1);
514 fatal_error("Cannot read introductory block");
515 }
516 bytes_to_be_read = atol(tmp1);
517 }
518 log_msg(1, "tmpA is %s", tmp1);
519 if (!strstr(tmp1, PIMP_END_SZ)) {
520 if (fread(tmp1, 1, 64, fin) != 64) {
521 mr_free(tmp1);
522 fatal_error("Can't read the final block");
523 }
524 log_msg(5, "tmpB is %s", tmp1);
525 if (!strstr(tmp1, PIMP_END_SZ)) {
526 mr_asprintf(filestr, "%s/out.leftover", bkpinfo->tmpdir);
527 ftmp = fopen(filestr, "w");
528 mr_free(filestr);
529
530 bytes_read_in = fread(tmp1, 1, 64, fin);
531 log_msg(1, "bytes_read_in = %ld", bytes_read_in);
532
533 fwrite(tmp1, 1, bytes_read_in, ftmp);
534 fread(tmp1, 1, tmpcap, fin);
535 log_msg(0, "tmp1 = '%s'", tmp1);
536 fwrite(tmp1, 1, tmpcap, ftmp);
537 fclose(ftmp);
538 mr_free(tmp1);
539 fatal_error("Missing terminating block");
540 }
541 }
542 mr_free(tmp1);
543 }
544
545 paranoid_free(buf);
546 log_msg(3, "Successfully copied %ld bytes", bytes_written_out);
547 return (retval);
548}
549
550
551
552
553/**
554 * Feed @p input_device through ntfsclone to @p output_fname.
555 * @param input_device The device to image.
556 * @param output_fname The file to write.
557 * @return 0 for success, nonzero for failure.
558 */
559int feed_into_ntfsprog(char *input_device, char *output_fname)
560{
561// BACKUP
562 int res = -1;
563 char *command = NULL;
564
565 if (!does_file_exist(input_device)) {
566 fatal_error("input device does not exist");
567 }
568 command = find_home_of_exe("ntfsclone");
569 if (!command) {
570 mr_free(command);
571 fatal_error("ntfsclone not found");
572 }
573 mr_free(command);
574
575 mr_asprintf(command, "ntfsclone --force --save-image --overwrite %s %s", output_fname, input_device);
576 res = run_program_and_log_output(command, 5);
577 mr_free(command);
578
579 unlink(output_fname);
580 return (res);
581}
582
583
584void *run_prog_in_bkgd_then_exit(void *info)
585{
586 char *sz_command;
587 static int res = 4444;
588
589 res = 999;
590 sz_command = (char *) info;
591 log_msg(4, "sz_command = '%s'", sz_command);
592 res = system(sz_command);
593 if (res > 256 && res != 4444) {
594 res = res / 256;
595 }
596 log_msg(4, "child res = %d", res);
597 sz_command[0] = '\0';
598 pthread_exit((void *) (&res));
599}
600
601
602
603
604int run_external_binary_with_percentage_indicator_NEW(char *tt, char *cmd) {
605
606 /*@ int *************************************************************** */
607 int res = 0;
608 int percentage = 0;
609 int maxpc = 100;
610 int pcno = 0;
611 int last_pcno = 0;
612 int counter = 0;
613
614 /*@ buffers *********************************************************** */
615 char *command = NULL;
616 char *title = NULL;
617 /*@ pointers ********************************************************** */
618 static int chldres = 0;
619 int *pchild_result;
620 pthread_t childthread;
621
622 pchild_result = &chldres;
623 assert_string_is_neither_NULL_nor_zerolength(cmd);
624 assert_string_is_neither_NULL_nor_zerolength(tt);
625 *pchild_result = 999;
626
627 mr_asprintf(command, "%s 2>> %s", cmd, MONDO_LOGFILE);
628 log_msg(3, "command = '%s'", command);
629 if ((res = pthread_create(&childthread, NULL, run_prog_in_bkgd_then_exit, (void *) command))) {
630 fatal_error("Unable to create an archival thread");
631 }
632
633 log_msg(8, "Parent running");
634 mr_asprintf(title, "%s", tt);
635 open_evalcall_form(title);
636 mr_free(title);
637
638 for (sleep(1); command[0] != '\0'; sleep(1)) {
639 pcno = grab_percentage_from_last_line_of_file(MONDO_LOGFILE);
640 if (pcno < 0 || pcno > 100) {
641 log_msg(8, "Weird pc# %d", pcno);
642 continue;
643 }
644 percentage = pcno * 100 / maxpc;
645 if (pcno <= 5 && last_pcno >= 40) {
646 close_evalcall_form();
647 mr_asprintf(title, "Verifying...");
648 open_evalcall_form(title);
649 mr_free(title);
650 }
651 if (counter++ >= 5) {
652 counter = 0;
653 log_file_end_to_screen(MONDO_LOGFILE, "");
654 }
655 last_pcno = pcno;
656 update_evalcall_form(percentage);
657 }
658 mr_free(command);
659
660 log_file_end_to_screen(MONDO_LOGFILE, "");
661 close_evalcall_form();
662 pthread_join(childthread, (void *) (&pchild_result));
663 if (pchild_result) {
664 res = *pchild_result;
665 } else {
666 res = 666;
667 }
668 log_msg(3, "Parent res = %d", res);
669 return (res);
670}
671
672
673/**
674 * Feed @p input_fifo through ntfsclone (restore) to @p output_device.
675 * @param input_fifo The ntfsclone file to read.
676 * @param output_device Where to put the output.
677 * @return The return value of ntfsclone (0 for success).
678 */
679int feed_outfrom_ntfsprog(char *output_device, char *input_fifo)
680{
681// RESTORE
682 int res = -1;
683 char *command = NULL;
684
685 command = find_home_of_exe("ntfsclone");
686 if (!command) {
687 mr_free(command);
688 fatal_error("ntfsclone not found");
689 }
690 mr_free(command);
691
692 mr_asprintf(command, "ntfsclone --force --restore-image --overwrite %s %s", output_device, input_fifo);
693 res = run_program_and_log_output(command, 5);
694 mr_free(command);
695 return (res);
696}
Note: See TracBrowser for help on using the repository browser.