source: MondoRescue/trunk/mondo/mondo/common/libmondo-fork.c@ 729

Last change on this file since 729 was 689, checked in by bcornec, 18 years ago

Still other memory management improvements ( I hope :-)

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