aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/tools
diff options
context:
space:
mode:
authorTor Lillqvist <tml@novell.com>2005-12-17 20:10:36 +0800
committerTor Lillqvist <tml@src.gnome.org>2005-12-17 20:10:36 +0800
commit61eb0898d02426fa632fd986346f6d6b9c35d5bc (patch)
treee5efa48651d598681bab4815ae9b8de1d7736b0e /addressbook/tools
parenteea1c3e8d6351725a3879f2ef48c38bde07f1faa (diff)
downloadgsoc2013-evolution-61eb0898d02426fa632fd986346f6d6b9c35d5bc.tar
gsoc2013-evolution-61eb0898d02426fa632fd986346f6d6b9c35d5bc.tar.gz
gsoc2013-evolution-61eb0898d02426fa632fd986346f6d6b9c35d5bc.tar.bz2
gsoc2013-evolution-61eb0898d02426fa632fd986346f6d6b9c35d5bc.tar.lz
gsoc2013-evolution-61eb0898d02426fa632fd986346f6d6b9c35d5bc.tar.xz
gsoc2013-evolution-61eb0898d02426fa632fd986346f6d6b9c35d5bc.tar.zst
gsoc2013-evolution-61eb0898d02426fa632fd986346f6d6b9c35d5bc.zip
Use gstdio wrappers. No fork() on Windows, but the fork-to-background
2005-12-17 Tor Lillqvist <tml@novell.com> * 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
Diffstat (limited to 'addressbook/tools')
-rw-r--r--addressbook/tools/evolution-addressbook-export-list-cards.c15
1 files changed, 13 insertions, 2 deletions
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 <unistd.h>
#include <glib.h>
+#include <glib/gstdio.h>
#include <bonobo-activation/bonobo-activation.h>
#include <libbonobo.h>
#include <libgnome/libgnome.h>
@@ -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
}
}