From 30a7dc0d50bb4982b785654a3acadd3cffd45f65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Asbj=C3=B8rn=20Pettersen?= Date: Mon, 28 Aug 2000 18:34:14 +0000 Subject: [PATCH] fix OS2 gz problem --- ChangeLog | 5 +++++ plug-ins/common/compressor.c | 39 ++++++++++++++++++------------------ plug-ins/common/gz.c | 39 ++++++++++++++++++------------------ 3 files changed, 45 insertions(+), 38 deletions(-) diff --git a/ChangeLog b/ChangeLog index ed52c84adf..4631247686 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2000-08-28 Asbjorn Pettersen + + * plug-ins/common/gz.c (save_image): FIX OS/2 problem with loading/saving + gz files. Skip waitpid () for OS/2. + Sun Aug 27 22:41:36 CEST 2000 Marc Lehmann * configure.in, plug-ins/perl/po/Makefile.in.in: moved po-perl to diff --git a/plug-ins/common/compressor.c b/plug-ins/common/compressor.c index 2c0c0234c2..9f350cfe19 100644 --- a/plug-ins/common/compressor.c +++ b/plug-ins/common/compressor.c @@ -339,7 +339,14 @@ save_image (gchar *filename, } #ifndef G_OS_WIN32 -#ifndef __EMX__ +#ifdef __EMX__ + if (spawn_gzip (filename, tmpname, "-cf", &pid) == -1) + { + g_free (tmpname); + return STATUS_EXECUTION_ERROR; + } + sleep (2); /* silly wait */ +#else /* UNIX */ /* fork off a gzip process */ if ((pid = fork ()) < 0) { @@ -368,13 +375,6 @@ save_image (gchar *filename, _exit(127); } else -#else /* __EMX__ */ - if (spawn_gzip (filename, tmpname, "-cf", &pid) == -1) - { - g_free (tmpname); - return GIMP_PDB_EXECUTION_ERROR; - } -#endif { waitpid (pid, &status, 0); @@ -386,6 +386,7 @@ save_image (gchar *filename, return 0; } } +#endif #else /* G_OS_WIN32 */ in = fopen (tmpname, "rb"); out = fopen (filename, "wb"); @@ -447,9 +448,16 @@ load_image (gchar *filename, /* find a temp name */ tmpname = gimp_temp_name (ext + 1); -#ifndef G_OS_WIN32 -#ifndef __EMX__ - /* fork off a g(un)zip and wait for it */ +#ifndef G_OS_WIN32 +#ifdef __EMX__ + if (spawn_gzip (tmpname, filename, "-cfd", &pid) == -1) + { + g_free (tmpname); + *status = STATUS_EXECUTION_ERROR; + return -1; + } +#else /* UNIX */ +/* fork off a g(un)zip and wait for it */ if ((pid = fork ()) < 0) { g_message ("gz: fork failed: %s\n", g_strerror (errno)); @@ -481,14 +489,6 @@ load_image (gchar *filename, _exit(127); } else /* parent process */ -#else /* __EMX__ */ - if (spawn_gzip (tmpname, filename, "-cfd", &pid) == -1) - { - g_free (tmpname); - *status = GIMP_PDB_EXECUTION_ERROR; - return -1; - } -#endif { waitpid (pid, &process_status, 0); @@ -501,6 +501,7 @@ load_image (gchar *filename, return -1; } } +#endif #else in = fopen (filename, "rb"); out = fopen (tmpname, "wb"); diff --git a/plug-ins/common/gz.c b/plug-ins/common/gz.c index 2c0c0234c2..9f350cfe19 100644 --- a/plug-ins/common/gz.c +++ b/plug-ins/common/gz.c @@ -339,7 +339,14 @@ save_image (gchar *filename, } #ifndef G_OS_WIN32 -#ifndef __EMX__ +#ifdef __EMX__ + if (spawn_gzip (filename, tmpname, "-cf", &pid) == -1) + { + g_free (tmpname); + return STATUS_EXECUTION_ERROR; + } + sleep (2); /* silly wait */ +#else /* UNIX */ /* fork off a gzip process */ if ((pid = fork ()) < 0) { @@ -368,13 +375,6 @@ save_image (gchar *filename, _exit(127); } else -#else /* __EMX__ */ - if (spawn_gzip (filename, tmpname, "-cf", &pid) == -1) - { - g_free (tmpname); - return GIMP_PDB_EXECUTION_ERROR; - } -#endif { waitpid (pid, &status, 0); @@ -386,6 +386,7 @@ save_image (gchar *filename, return 0; } } +#endif #else /* G_OS_WIN32 */ in = fopen (tmpname, "rb"); out = fopen (filename, "wb"); @@ -447,9 +448,16 @@ load_image (gchar *filename, /* find a temp name */ tmpname = gimp_temp_name (ext + 1); -#ifndef G_OS_WIN32 -#ifndef __EMX__ - /* fork off a g(un)zip and wait for it */ +#ifndef G_OS_WIN32 +#ifdef __EMX__ + if (spawn_gzip (tmpname, filename, "-cfd", &pid) == -1) + { + g_free (tmpname); + *status = STATUS_EXECUTION_ERROR; + return -1; + } +#else /* UNIX */ +/* fork off a g(un)zip and wait for it */ if ((pid = fork ()) < 0) { g_message ("gz: fork failed: %s\n", g_strerror (errno)); @@ -481,14 +489,6 @@ load_image (gchar *filename, _exit(127); } else /* parent process */ -#else /* __EMX__ */ - if (spawn_gzip (tmpname, filename, "-cfd", &pid) == -1) - { - g_free (tmpname); - *status = GIMP_PDB_EXECUTION_ERROR; - return -1; - } -#endif { waitpid (pid, &process_status, 0); @@ -501,6 +501,7 @@ load_image (gchar *filename, return -1; } } +#endif #else in = fopen (filename, "rb"); out = fopen (tmpname, "wb");