From 61eb0898d02426fa632fd986346f6d6b9c35d5bc Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Sat, 17 Dec 2005 12:10:36 +0000 Subject: Use gstdio wrappers. No fork() on Windows, but the fork-to-background 2005-12-17 Tor Lillqvist * tools/evolution-addressbook-export-list-cards.c: Use gstdio wrappers. No fork() on Windows, but the fork-to-background functionality doesn't seem essential? svn path=/trunk/; revision=30801 --- .../tools/evolution-addressbook-export-list-cards.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'addressbook/tools') diff --git a/addressbook/tools/evolution-addressbook-export-list-cards.c b/addressbook/tools/evolution-addressbook-export-list-cards.c index 5538b85b35..e8f2749861 100644 --- a/addressbook/tools/evolution-addressbook-export-list-cards.c +++ b/addressbook/tools/evolution-addressbook-export-list-cards.c @@ -28,6 +28,7 @@ #include #include +#include #include #include #include @@ -616,6 +617,7 @@ output_n_cards_file (FILE * outputfile, GList *contacts, int size, int begin_no, static void fork_to_background (void) { +#ifndef G_OS_WIN32 pid_t pid; pid = fork (); if (pid == -1) { @@ -630,6 +632,7 @@ fork_to_background (void) /* parent exit, note the use of _exit() instead of exit() */ _exit (-1); } +#endif } @@ -660,7 +663,7 @@ action_list_cards (GList *contacts, ActionContext * p_actctx) outputfile = stdout; } else { /* fopen output file */ - if (!(outputfile = fopen (p_actctx->action_list_cards.output_file, "w"))) { + if (!(outputfile = g_fopen (p_actctx->action_list_cards.output_file, "w"))) { g_warning (_("Can not open file")); exit (-1); } @@ -696,7 +699,7 @@ action_list_cards (GList *contacts, ActionContext * p_actctx) g_strdup_printf ("%s.%04d", p_actctx->action_list_cards.output_file, series_no); } - if (!(outputfile = fopen (file_series_name, "w"))) { + if (!(outputfile = g_fopen (file_series_name, "w"))) { g_warning (_("Can not open file")); exit (-1); } @@ -721,6 +724,14 @@ action_list_cards (GList *contacts, ActionContext * p_actctx) } while (series_no * size < length); g_free (file_series_name); +#ifdef G_OS_WIN32 + /* On Unix the parent exits already in + * fork_to_background(), but without fork() exit only + * after doing the job. XXX Is this correct? + */ + if (IsFirstOne == FALSE) + _exit (-1); +#endif } } -- cgit