gvfs r1254 - in trunk: . client common daemon



Author: alexl
Date: Mon Feb 11 11:46:23 2008
New Revision: 1254
URL: http://svn.gnome.org/viewvc/gvfs?rev=1254&view=rev

Log:
2008-02-11  Alexander Larsson  <alexl redhat com>

        * client/gdaemonfile.c:
        * client/gdaemonfileinputstream.c:
        * client/gdaemonfileoutputstream.c:
        * common/gsysutils.c:
        * common/gvfsdaemonprotocol.c:
        * daemon/gvfsbackendburn.c:
        * daemon/gvfsbackendcdda.c:
        * daemon/gvfsbackenddav.c:
        * daemon/gvfsbackendsftp.c:
        * daemon/gvfsbackendsmb.c:
        * daemon/gvfsbackendsmbbrowse.c:
        * daemon/gvfsbackendtest.c:
        * daemon/gvfsdaemonutils.c:
        * daemon/gvfsjob.c:
        * daemon/mount.c:
        * daemon/pty_open.c:
	Save errno befor making other calls.
	Be safe when calling g_set_error()
	Patch from Christian Persch (#514822)




Modified:
   trunk/ChangeLog
   trunk/client/gdaemonfile.c
   trunk/client/gdaemonfileinputstream.c
   trunk/client/gdaemonfileoutputstream.c
   trunk/common/gsysutils.c
   trunk/common/gvfsdaemonprotocol.c
   trunk/daemon/gvfsbackendburn.c
   trunk/daemon/gvfsbackendcdda.c
   trunk/daemon/gvfsbackenddav.c
   trunk/daemon/gvfsbackendsftp.c
   trunk/daemon/gvfsbackendsmb.c
   trunk/daemon/gvfsbackendsmbbrowse.c
   trunk/daemon/gvfsbackendtest.c
   trunk/daemon/gvfsdaemonutils.c
   trunk/daemon/gvfsjob.c
   trunk/daemon/mount.c
   trunk/daemon/pty_open.c

Modified: trunk/client/gdaemonfile.c
==============================================================================
--- trunk/client/gdaemonfile.c	(original)
+++ trunk/client/gdaemonfile.c	Mon Feb 11 11:46:23 2008
@@ -461,7 +461,7 @@
 	  g_mount_info_unref (mount_info1);
 	  /* For copy this will cause the fallback code to be involved */
 	  g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
-		       _("Operation not supported, files on different mounts"));
+		       "%s", _("Operation not supported, files on different mounts"));
 	  return NULL;
 	}
     }
@@ -746,7 +746,7 @@
       (dbus_message_iter_get_arg_type (&iter) != DBUS_TYPE_STRUCT))
     {
       g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
-		   _("Invalid return value from get_info"));
+		   "%s", _("Invalid return value from get_info"));
       goto out;
     }
 
@@ -949,7 +949,7 @@
     {
       dbus_message_unref (reply);
       g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
-		   _("Invalid return value from open"));
+		   "%s", _("Invalid return value from open"));
       return NULL;
     }
   
@@ -959,7 +959,7 @@
   if (fd == -1)
     {
       g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
-		   _("Didn't get stream file descriptor"));
+		   "%s", _("Didn't get stream file descriptor"));
       return NULL;
     }
   
@@ -1008,7 +1008,7 @@
     {
       dbus_message_unref (reply);
       g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
-		   _("Invalid return value from open"));
+		   "%s", _("Invalid return value from open"));
       return NULL;
     }
   
@@ -1018,7 +1018,7 @@
   if (fd == -1)
     {
       g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
-		   _("Didn't get stream file descriptor"));
+		   "%s", _("Didn't get stream file descriptor"));
       return NULL;
     }
   
@@ -1067,7 +1067,7 @@
     {
       dbus_message_unref (reply);
       g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
-		   _("Invalid return value from open"));
+		   "%s", _("Invalid return value from open"));
       return NULL;
     }
   
@@ -1077,7 +1077,7 @@
   if (fd == -1)
     {
       g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
-		   _("Didn't get stream file descriptor"));
+		   "%s", _("Didn't get stream file descriptor"));
       return NULL;
     }
   
@@ -1129,7 +1129,7 @@
     {
       dbus_message_unref (reply);
       g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
-		   _("Invalid return value from open"));
+		   "%s", _("Invalid return value from open"));
       return NULL;
     }
   
@@ -1139,7 +1139,7 @@
   if (fd == -1)
     {
       g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
-		   _("Didn't get stream file descriptor"));
+		   "%s", _("Didn't get stream file descriptor"));
       return NULL;
     }
   
@@ -1487,7 +1487,7 @@
       (dbus_message_iter_get_arg_type (&iter) != DBUS_TYPE_STRUCT))
     {
       g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
-		   _("Invalid return value from get_filesystem_info"));
+		   "%s", _("Invalid return value from get_filesystem_info"));
       goto out;
     }
 
@@ -1526,7 +1526,7 @@
 	       G_IO_ERROR_NOT_FOUND,
   /* translators: this is an error message when there is no user visible "mount" object
      corresponding to a particular path/uri */
-	       _("Could not find enclosing mount"));
+	       "%s", _("Could not find enclosing mount"));
   return NULL;
 }
 
@@ -1598,7 +1598,7 @@
 				      0))
     {
       g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
-		   _("Invalid return value from query_filesystem_info"));
+		   "%s", _("Invalid return value from query_filesystem_info"));
       goto out;
     }
 
@@ -1838,7 +1838,7 @@
   if (!G_IS_DAEMON_FILE (destination))
     {
       /* Fall back to default move */
-      g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED, "Move not supported");
+      g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED, "%s", "Move not supported");
       return FALSE;
     }
   daemon_dest = G_DAEMON_FILE (destination);
@@ -1857,7 +1857,7 @@
 	{
 	  /* This will cause the fallback code to be involved */
 	  g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
-		       _("Operation not supported, files on different mounts"));
+		       "%s", _("Operation not supported, files on different mounts"));
 	  return FALSE;
 	}
     }
@@ -1930,7 +1930,7 @@
       !G_IS_DAEMON_FILE (destination))
     {
       /* Fall back to default move */
-      g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED, "Move not supported");
+      g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED, "%s", "Move not supported");
       return FALSE;
     }
   
@@ -2006,7 +2006,7 @@
       g_mount_info_unref (mount_info);
       dbus_message_unref (reply);
       g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
-		   _("Invalid return value from monitor_dir"));
+		   "%s", _("Invalid return value from monitor_dir"));
       return NULL;
     }
   
@@ -2055,7 +2055,7 @@
       g_mount_info_unref (mount_info);
       dbus_message_unref (reply);
       g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
-		   _("Invalid return value from monitor_file"));
+		   "%s", _("Invalid return value from monitor_file"));
       return NULL;
     }
   

Modified: trunk/client/gdaemonfileinputstream.c
==============================================================================
--- trunk/client/gdaemonfileinputstream.c	(original)
+++ trunk/client/gdaemonfileinputstream.c	Mon Feb 11 11:46:23 2008
@@ -380,7 +380,8 @@
   g_set_error (error,
 	       g_quark_from_string (data),
 	       reply->arg1,
-	       data + strlen (data) + 1);
+               "%s",
+               data + strlen (data) + 1);
 }
 
 
@@ -515,7 +516,7 @@
 	      g_set_error (&op->ret_error,
 			   G_IO_ERROR,
 			   G_IO_ERROR_CANCELLED,
-			   _("Operation was cancelled"));
+			   "%s", _("Operation was cancelled"));
 	      return STATE_OP_DONE;
 	    }
 	  
@@ -671,6 +672,7 @@
 	      g_set_error (&op->ret_error,
 			   G_IO_ERROR,
 			   G_IO_ERROR_CANCELLED,
+                           "%s",
 			   _("Operation was cancelled"));
 	      return STATE_OP_DONE;
 	    }
@@ -778,6 +780,7 @@
 	      g_set_error (&op->ret_error,
 			   G_IO_ERROR,
 			   G_IO_ERROR_CANCELLED,
+                           "%s",
 			   _("Operation was cancelled"));
 	      return STATE_OP_DONE;
 	    }
@@ -1028,6 +1031,7 @@
 	      g_set_error (&op->ret_error,
 			   G_IO_ERROR,
 			   G_IO_ERROR_CANCELLED,
+                           "%s",
 			   _("Operation was cancelled"));
 	      return STATE_OP_DONE;
 	    }
@@ -1203,7 +1207,7 @@
   if (!file->can_seek)
     {
       g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
-		   _("Seek not supported on stream"));
+		   "%s", _("Seek not supported on stream"));
       return FALSE;
     }
   
@@ -1237,7 +1241,7 @@
 
   file = G_DAEMON_FILE_INPUT_STREAM (stream);
 
-  g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED, _("The query info operation is not supported"));
+  g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED, "%s", _("The query info operation is not supported"));
   
   return NULL;
 }

Modified: trunk/client/gdaemonfileoutputstream.c
==============================================================================
--- trunk/client/gdaemonfileoutputstream.c	(original)
+++ trunk/client/gdaemonfileoutputstream.c	Mon Feb 11 11:46:23 2008
@@ -332,6 +332,7 @@
   g_set_error (error,
 	       g_quark_from_string (data),
 	       reply->arg1,
+               "%s",
 	       data + strlen (data) + 1);
 }
 
@@ -455,7 +456,8 @@
 	      g_set_error (&op->ret_error,
 			   G_IO_ERROR,
 			   G_IO_ERROR_CANCELLED,
-			   _("Operation was cancelled"));
+			   "%s",
+                           _("Operation was cancelled"));
 	      return STATE_OP_DONE;
 	    }
 	  
@@ -633,6 +635,7 @@
 	      g_set_error (&op->ret_error,
 			   G_IO_ERROR,
 			   G_IO_ERROR_CANCELLED,
+                           "%s",
 			   _("Operation was cancelled"));
 	      return STATE_OP_DONE;
 	    }
@@ -828,6 +831,7 @@
 	      g_set_error (&op->ret_error,
 			   G_IO_ERROR,
 			   G_IO_ERROR_CANCELLED,
+                           "%s",
 			   _("Operation was cancelled"));
 	      return STATE_OP_DONE;
 	    }
@@ -939,7 +943,7 @@
   if (!file->can_seek)
     {
       g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
-		   _("Seek not supported on stream"));
+		   "%s", _("Seek not supported on stream"));
       return FALSE;
     }
   

Modified: trunk/common/gsysutils.c
==============================================================================
--- trunk/common/gsysutils.c	(original)
+++ trunk/common/gsysutils.c	Mon Feb 11 11:46:23 2008
@@ -120,10 +120,12 @@
   fd = socket (PF_UNIX, SOCK_STREAM, 0);
   if (fd == -1)
     {
+      int errsv = errno;
+
       g_set_error (error, G_IO_ERROR,
-		   g_io_error_from_errno (errno),
+		   g_io_error_from_errno (errsv),
 		   _("Error creating socket: %s"),
-		   g_strerror (errno));
+		   g_strerror (errsv));
       return -1;
     }
   
@@ -156,10 +158,12 @@
   
   if (connect (fd, (struct sockaddr*) &addr, G_STRUCT_OFFSET (struct sockaddr_un, sun_path) + path_len) < 0)
     {      
+      int errsv = errno;
+
       g_set_error (error, G_IO_ERROR,
-		   g_io_error_from_errno (errno),
+		   g_io_error_from_errno (errsv),
 		   _("Error connecting to socket: %s"),
-		   g_strerror (errno));
+		   g_strerror (errsv));
       close (fd);
       return -1;
     }

Modified: trunk/common/gvfsdaemonprotocol.c
==============================================================================
--- trunk/common/gvfsdaemonprotocol.c	(original)
+++ trunk/common/gvfsdaemonprotocol.c	Mon Feb 11 11:46:23 2008
@@ -512,7 +512,7 @@
  error:
   g_object_unref (info);
   g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
-	       _("Invalid file info format"));
+	       "%s", _("Invalid file info format"));
   return NULL;
 }
 
@@ -529,7 +529,7 @@
       dbus_message_iter_get_element_type (iter) != DBUS_TYPE_STRUCT)
     {
       g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
-		   _("Invalid attribute info list content"));
+		   "%s", _("Invalid attribute info list content"));
       return NULL;
     }
 

Modified: trunk/daemon/gvfsbackendburn.c
==============================================================================
--- trunk/daemon/gvfsbackendburn.c	(original)
+++ trunk/daemon/gvfsbackendburn.c	Mon Feb 11 11:46:23 2008
@@ -824,10 +824,12 @@
   
   if (g_stat (local_path, &stat_buf) == -1)
     {
+      int errsv = errno;
+
       g_vfs_job_failed (G_VFS_JOB (job),
                         G_IO_ERROR,
-                        g_io_error_from_errno (errno),
-                        g_strerror (errno));
+                        g_io_error_from_errno (errsv),
+                        "%s", g_strerror (errsv));
       return TRUE;
     }
 

Modified: trunk/daemon/gvfsbackendcdda.c
==============================================================================
--- trunk/daemon/gvfsbackendcdda.c	(original)
+++ trunk/daemon/gvfsbackendcdda.c	Mon Feb 11 11:46:23 2008
@@ -142,7 +142,7 @@
   //g_warning ("host=%s", host);
   if (host == NULL)
     {
-      g_set_error (&error, G_IO_ERROR, G_IO_ERROR_FAILED, _("No drive specified"));
+      g_set_error (&error, G_IO_ERROR, G_IO_ERROR_FAILED, "%s", _("No drive specified"));
       g_vfs_job_failed_from_error (G_VFS_JOB (job), error);
       g_error_free (error);
       return;
@@ -209,7 +209,7 @@
   //g_warning ("tm host=%s", host);
   if (host == NULL)
     {
-      g_set_error (&error, G_IO_ERROR, G_IO_ERROR_FAILED, _("No drive specified"));
+      g_set_error (&error, G_IO_ERROR, G_IO_ERROR_FAILED, "%s", _("No drive specified"));
       g_vfs_job_failed_from_error (G_VFS_JOB (job), error);
       g_error_free (error);
       return TRUE;
@@ -530,8 +530,10 @@
 
       if (readbuf == NULL)
         {
+          int errsv = errno;
+
           g_vfs_job_failed (G_VFS_JOB (job), G_IO_ERROR,
-                            g_io_error_from_errno (errno),
+                            g_io_error_from_errno (errsv),
                             /* Translators: paranoia is the name of the cd audio reading library */
                             _("Error from 'paranoia' on drive %s"), cdda_backend->device_path);
           return;

Modified: trunk/daemon/gvfsbackenddav.c
==============================================================================
--- trunk/daemon/gvfsbackenddav.c	(original)
+++ trunk/daemon/gvfsbackenddav.c	Mon Feb 11 11:46:23 2008
@@ -164,7 +164,7 @@
   if (doc == NULL)
     { 
       g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
-                   _("Could not parse response"));
+                   "%s", _("Could not parse response"));
       return NULL;
     }
 
@@ -173,14 +173,14 @@
   if (doc == NULL)
     {
       g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
-                   _("Empty response"));
+                   "%s", _("Empty response"));
       return NULL;
     }
 
   if (strcmp ((char *) (*root)->name, name))
     {
         g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
-                     _("Unexpected reply from server"));
+                     "%s", _("Unexpected reply from server"));
       return NULL;
     }
 

Modified: trunk/daemon/gvfsbackendsftp.c
==============================================================================
--- trunk/daemon/gvfsbackendsftp.c	(original)
+++ trunk/daemon/gvfsbackendsftp.c	Mon Feb 11 11:46:23 2008
@@ -246,7 +246,7 @@
           /* Error (real or WOULDBLOCK) or EOF */
           g_set_error (error,
                        G_IO_ERROR, G_IO_ERROR_FAILED,
-                       _("ssh program unexpectedly exited"));
+                       "%s", _("ssh program unexpectedly exited"));
           return;
         }
       
@@ -254,35 +254,35 @@
         {
           g_set_error (error,
                        G_IO_ERROR, G_IO_ERROR_PERMISSION_DENIED,
-                       _("Permission denied"));
+                       "%s", _("Permission denied"));
           return;
         }
       else if (strstr (line, "Name or service not known") != NULL)
         {
           g_set_error (error,
                        G_IO_ERROR, G_IO_ERROR_HOST_NOT_FOUND,
-                       _("Hostname not known"));
+                       "%s", _("Hostname not known"));
           return;
         }
       else if (strstr (line, "No route to host") != NULL)
         {
           g_set_error (error,
                        G_IO_ERROR, G_IO_ERROR_HOST_NOT_FOUND,
-                       _("No route to host"));
+                       "%s", _("No route to host"));
           return;
         }
       else if (strstr (line, "Connection refused") != NULL)
         {
           g_set_error (error,
                        G_IO_ERROR, G_IO_ERROR_PERMISSION_DENIED,
-                       _("Connection refused by server"));
+                       "%s", _("Connection refused by server"));
           return;
         }
       else if (strstr (line, "Host key verification failed") != NULL) 
         {
           g_set_error (error,
                        G_IO_ERROR, G_IO_ERROR_FAILED,
-                       _("Host key verification failed"));
+                       "%s", _("Host key verification failed"));
           return;
         }
       
@@ -367,7 +367,7 @@
     {
       g_set_error (error,
 		   G_IO_ERROR, G_IO_ERROR_FAILED,
-		   _("Unable to spawn ssh program"));
+		   "%s", _("Unable to spawn ssh program"));
       return FALSE;
     }
 #else
@@ -486,7 +486,7 @@
     {
       g_set_error (error,
 		   G_IO_ERROR, G_IO_ERROR_TIMED_OUT,
-		   _("Timed out when logging in"));
+		   "%s", _("Timed out when logging in"));
       return FALSE;
     }
   return TRUE;
@@ -643,7 +643,7 @@
 	{
 	  g_set_error (error,
 		       G_IO_ERROR, G_IO_ERROR_TIMED_OUT,
-		       _("Timed out when logging in"));
+		       "%s", _("Timed out when logging in"));
 	  ret_val = FALSE;
 	  break;
 	}
@@ -705,7 +705,7 @@
 	    {
 	      g_set_error (error,
 			   G_IO_ERROR, G_IO_ERROR_PERMISSION_DENIED,
-			   _("Password dialog cancelled"));
+			   "%s", _("Password dialog cancelled"));
 	      ret_val = FALSE;
 	      break;
 	    }
@@ -721,7 +721,7 @@
 	    {
 	      g_set_error (error,
 			   G_IO_ERROR, G_IO_ERROR_PERMISSION_DENIED,
-			   _("Can't send password"));
+			   "%s", _("Can't send password"));
 	      ret_val = FALSE;
 	      break;
 	    }
@@ -1087,7 +1087,7 @@
   
   if (g_data_input_stream_read_byte (reply, NULL, NULL) != SSH_FXP_VERSION)
     {
-      g_set_error (&error, G_IO_ERROR, G_IO_ERROR_FAILED, _("Protocol error"));
+      g_set_error (&error, G_IO_ERROR, G_IO_ERROR_FAILED, "%s", _("Protocol error"));
       g_vfs_job_failed_from_error (G_VFS_JOB (job), error);
       g_error_free (error);
       return;
@@ -1110,7 +1110,7 @@
 
   if (!get_uid_sync (op_backend))
     {
-      g_set_error (&error, G_IO_ERROR, G_IO_ERROR_FAILED, _("Protocol error"));
+      g_set_error (&error, G_IO_ERROR, G_IO_ERROR_FAILED, "%s", _("Protocol error"));
       g_vfs_job_failed_from_error (G_VFS_JOB (job), error);
       g_error_free (error);
       return;
@@ -1892,7 +1892,7 @@
     res = error_from_status (job, reply, -1, -1, &error);
   else
     g_set_error (&error, G_IO_ERROR, G_IO_ERROR_FAILED,
-                 _("Invalid reply received"));
+                 "%s", _("Invalid reply received"));
 
   if (res)
     {
@@ -1940,7 +1940,7 @@
     res = error_from_status (job, reply, -1, -1, &error);
   else
     g_set_error (&error, G_IO_ERROR, G_IO_ERROR_FAILED,
-                 _("Invalid reply received"));
+                 "%s", _("Invalid reply received"));
 
   if (res)
     {
@@ -2019,7 +2019,7 @@
     res = error_from_status (job, reply, -1, -1, &error);
   else
     g_set_error (&error, G_IO_ERROR, G_IO_ERROR_FAILED,
-                 _("Invalid reply received"));
+                 "%s", _("Invalid reply received"));
 
   if (res)
     {
@@ -3021,7 +3021,7 @@
     error_from_status (job, reply, -1, -1, &data->stat_error);
   else if (reply_type != SSH_FXP_ATTRS)
     g_set_error (&data->stat_error, G_IO_ERROR, G_IO_ERROR_FAILED,
-                 _("Invalid reply received"));
+                 "%s", _("Invalid reply received"));
   else
     {
       data->stat_info = g_file_info_new ();
@@ -3054,7 +3054,7 @@
     error_from_status (job, reply, -1, -1, &data->lstat_error);
   else if (reply_type != SSH_FXP_ATTRS)
     g_set_error (&data->lstat_error, G_IO_ERROR, G_IO_ERROR_FAILED,
-                 _("Invalid reply received"));
+                 "%s", _("Invalid reply received"));
   else
     {
       data->lstat_info = g_file_info_new ();

Modified: trunk/daemon/gvfsbackendsmb.c
==============================================================================
--- trunk/daemon/gvfsbackendsmb.c	(original)
+++ trunk/daemon/gvfsbackendsmb.c	Mon Feb 11 11:46:23 2008
@@ -898,9 +898,11 @@
 					O_CREAT|O_WRONLY|O_EXCL, 0);
   if (file == NULL && errno != EEXIST)
     {
+      int errsv = errno;
+
       g_set_error (&error, G_IO_ERROR,
-		   g_io_error_from_errno (errno),
-		   g_strerror (errno));
+		   g_io_error_from_errno (errsv),
+		   "%s", g_strerror (errsv));
       goto error;
     }
   else if (file == NULL && errno == EEXIST)
@@ -918,7 +920,8 @@
 		  g_set_error (&error,
 			       G_IO_ERROR,
 			       G_IO_ERROR_WRONG_ETAG,
-			       _("The file was externally modified"));
+			       "%s",
+                               _("The file was externally modified"));
 		  goto error;
 		}
 	      g_free (current_etag);
@@ -949,11 +952,13 @@
 		    g_set_error (&error,
 				 G_IO_ERROR,
 				 G_IO_ERROR_CANCELLED,
+                                 "%s",
 				 _("Operation was cancelled"));
 		  else
 		    g_set_error (&error,
 				 G_IO_ERROR,
 				 G_IO_ERROR_CANT_CREATE_BACKUP,
+                                 "%s",
 				 _("Backup file creation failed"));
 		  goto error;
 		}
@@ -965,9 +970,11 @@
 						O_CREAT|O_WRONLY|O_TRUNC, 0);
 	  if (file == NULL)
 	    {
+              int errsv = errno;
+
 	      g_set_error (&error, G_IO_ERROR,
-			   g_io_error_from_errno (errno),
-			   g_strerror (errno));
+			   g_io_error_from_errno (errsv),
+			   "%s", g_strerror (errsv));
 	      goto error;
 	    }
 	}
@@ -1097,10 +1104,12 @@
 						 op_backend->smb_context, handle->backup_uri);
 	  if (res ==  -1)
 	    {
+              int errsv = errno;
+
 	      op_backend->smb_context->unlink (op_backend->smb_context, handle->tmp_uri);
 	      g_vfs_job_failed (G_VFS_JOB (job),
 				G_IO_ERROR, G_IO_ERROR_CANT_CREATE_BACKUP,
-				_("Backup file creation failed: %d"), errno);
+				_("Backup file creation failed: %s"), g_strerror (errsv));
 	      goto out;
 	    }
 	}
@@ -1409,10 +1418,12 @@
 
   if (dir == NULL)
     {
+      int errsv = errno;
+
       error = NULL;
       g_set_error (&error, G_IO_ERROR,
-		   g_io_error_from_errno (errno),
-		   g_strerror (errno));
+		   g_io_error_from_errno (errsv),
+		   "%s", g_strerror (errsv));
       goto error;
     }
 
@@ -1550,11 +1561,13 @@
   res = op_backend->smb_context->stat (op_backend->smb_context, uri, &statbuf);
   if (res == -1)
     {
+      errsv = errno;
+
       g_vfs_job_failed (G_VFS_JOB (job),
 			G_IO_ERROR,
-			g_io_error_from_errno (errno),
+			g_io_error_from_errno (errsv),
 			_("Error deleting file: %s"),
-			g_strerror (errno));
+			g_strerror (errsv));
       g_free (uri);
       return;
     }
@@ -1612,11 +1625,13 @@
   res = op_backend->smb_context->stat (op_backend->smb_context, source_uri, &statbuf);
   if (res == -1)
     {
+      errsv = errno;
+
       g_vfs_job_failed (G_VFS_JOB (job),
 			G_IO_ERROR,
-			g_io_error_from_errno (errno),
+			g_io_error_from_errno (errsv),
 			_("Error moving file: %s"),
-			g_strerror (errno));
+			g_strerror (errsv));
       g_free (source_uri);
       return;
     }

Modified: trunk/daemon/gvfsbackendsmbbrowse.c
==============================================================================
--- trunk/daemon/gvfsbackendsmbbrowse.c	(original)
+++ trunk/daemon/gvfsbackendsmbbrowse.c	Mon Feb 11 11:46:23 2008
@@ -778,12 +778,12 @@
       else
 	g_set_error (&error,
 		     G_IO_ERROR, G_IO_ERROR_NOT_MOUNTABLE_FILE,
-		     _("The file is not a mountable"));
+		     "%s", _("The file is not a mountable"));
     }
   else
     g_set_error (&error,
 		 G_IO_ERROR, G_IO_ERROR_NOT_FOUND,
-		 _("File doesn't exist"));
+		 "%s", _("File doesn't exist"));
       
   g_mutex_unlock (backend->entries_lock);
 

Modified: trunk/daemon/gvfsbackendtest.c
==============================================================================
--- trunk/daemon/gvfsbackendtest.c	(original)
+++ trunk/daemon/gvfsbackendtest.c	Mon Feb 11 11:46:23 2008
@@ -95,10 +95,12 @@
   fd = g_open (job->filename, O_RDONLY);
   if (fd == -1)
     {
+      int errsv = errno;
+
       g_vfs_job_failed (G_VFS_JOB (job), G_IO_ERROR,
-			g_io_error_from_errno (errno),
+			g_io_error_from_errno (errsv),
 			"Error opening file %s: %s",
-			job->filename, g_strerror (errno));
+			job->filename, g_strerror (errsv));
     }
   else
     {
@@ -158,10 +160,12 @@
 
   if (res == -1)
     {
+      int errsv = errno;
+
       g_vfs_job_failed (G_VFS_JOB (job), G_IO_ERROR,
-			g_io_error_from_errno (errno),
+			g_io_error_from_errno (errsv),
 			"Error reading from file: %s",
-			g_strerror (errno));
+			g_strerror (errsv));
     }
   else
     {
@@ -235,10 +239,12 @@
   
   if (final_offset == (off_t)-1)
     {
+      int errsv = errno;
+
       g_vfs_job_failed (G_VFS_JOB (job), G_IO_ERROR,
-			g_io_error_from_errno (errno),
+			g_io_error_from_errno (errsv),
 			"Error seeking in file: %s",
-			g_strerror (errno));
+			g_strerror (errsv));
     }
   else
     {

Modified: trunk/daemon/gvfsdaemonutils.c
==============================================================================
--- trunk/daemon/gvfsdaemonutils.c	(original)
+++ trunk/daemon/gvfsdaemonutils.c	Mon Feb 11 11:46:23 2008
@@ -97,10 +97,12 @@
 
   if (_g_socket_send_fd (extra->extra_fd, fd) == -1)
     {
+      int errsv = errno;
+
       g_set_error (error, G_IO_ERROR,
-		   g_io_error_from_errno (errno),
+		   g_io_error_from_errno (errsv),
 		   _("Error sending fd: %s"),
-		   g_strerror (errno));
+		   g_strerror (errsv));
       g_static_mutex_unlock (&extra_lock);
       return FALSE;
     }

Modified: trunk/daemon/gvfsjob.c
==============================================================================
--- trunk/daemon/gvfsjob.c	(original)
+++ trunk/daemon/gvfsjob.c	Mon Feb 11 11:46:23 2008
@@ -263,7 +263,7 @@
   
   g_set_error (&error, G_IO_ERROR,
 	       g_io_error_from_errno (errno_arg),
-	       g_strerror (errno_arg));
+	       "%s", g_strerror (errno_arg));
   g_vfs_job_failed_from_error (job, error);
   g_error_free (error);
 }

Modified: trunk/daemon/mount.c
==============================================================================
--- trunk/daemon/mount.c	(original)
+++ trunk/daemon/mount.c	Mon Feb 11 11:46:23 2008
@@ -369,13 +369,13 @@
 				  DBUS_TYPE_INVALID))
 	{
 	  g_set_error (&error, G_IO_ERROR, G_IO_ERROR_FAILED,
-		       _("Invalid arguments from spawned child"));
+		       "%s", _("Invalid arguments from spawned child"));
 	  mount_finish (data, error);
 	  g_error_free (error);
 	}
       else if (!succeeded)
 	{
-	  g_set_error (&error, G_IO_ERROR, G_IO_ERROR_FAILED, error_message);
+	  g_set_error (&error, G_IO_ERROR, G_IO_ERROR_FAILED, "%s", error_message);
 	  mount_finish (data, error);
 	  g_error_free (error);
 	}

Modified: trunk/daemon/pty_open.c
==============================================================================
--- trunk/daemon/pty_open.c	(original)
+++ trunk/daemon/pty_open.c	Mon Feb 11 11:46:23 2008
@@ -348,7 +348,7 @@
 #ifdef HAVE_UTMP_H
 	/* This sets stdin, stdout, stderr to the socket */	
 	if (login && login_tty (fd) == -1) {
-		g_printerr ("mount child process login_tty failed: %s\n", strerror (errno));
+		g_printerr ("mount child process login_tty failed: %s\n", g_strerror (errno));
 		return -1;
 	}
 #endif



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]