$NetBSD: patch-ac,v 1.4 2006/09/18 16:38:45 jmmv Exp $

--- gnome-screenshot/screenshot-save.c.orig	2006-06-11 13:19:30.000000000 +0200
+++ gnome-screenshot/screenshot-save.c
@@ -14,8 +14,6 @@ static char *tmp_filename = NULL;
 static SaveFunction save_callback = NULL;
 static gpointer save_user_data = NULL;
 
-extern int errno;
-
 
 
 /* Strategy for saving:
@@ -98,6 +96,7 @@ read_pipe_from_child (GIOChannel   *sour
       GtkWidget *dialog;
 
       g_io_channel_read_line (source, &error_message, NULL, NULL, NULL);
+      if (error_message != NULL && strcmp (error_message, "OK") != 0) {
       message = g_strdup_printf ("Unable to save the screenshot to disk:\n\n%s", error_message);
       dialog = gtk_message_dialog_new (NULL, 0,
 				       GTK_MESSAGE_ERROR,
@@ -106,6 +105,7 @@ read_pipe_from_child (GIOChannel   *sour
       gtk_dialog_run (GTK_DIALOG (dialog));
       gtk_widget_destroy (dialog);
       exit (1);
+      }
     }
 
   (*save_callback) (save_user_data);
@@ -194,8 +194,7 @@ screenshot_save_start (GdkPixbuf    *pix
 		   ERROR_MESSAGE,
 		   strlen (ERROR_MESSAGE));
 	}
-      /* By closing the pipe, we let the main process know that we're
-       * done saving it. */
+      write (pipe_from_child[1], "OK", strlen ("OK"));
       close (pipe_from_child[1]);
       read (parent_exit_notification[0], &c, 1);
 
@@ -211,7 +210,7 @@ screenshot_save_start (GdkPixbuf    *pix
 
       channel = g_io_channel_unix_new (pipe_from_child[0]);
       g_io_add_watch (channel,
-		      G_IO_IN | G_IO_ERR | G_IO_HUP | G_IO_NVAL,
+		      G_IO_IN | G_IO_ERR | G_IO_NVAL,
 		      read_pipe_from_child,
 		      NULL);
       g_io_channel_unref (channel);
