[PATCH] don't strcmp NULL when ejecting



The attached patch should partly fix bug 337014 [1].
Note that if (info->should_mount || info->should_unmount) is true, and
none of the mount commands could be found, info->argv is NULL but
strcmp'ed.

David, what do you propose in that case? I wonder why we hardcode the
mount helper paths instead of just looking for (p)umount/eject/HAL_EJECT
etc. in the path, i.e. by using g_find_program_in_path, and just passing
the last fallback command ("mount", "umount", "eject") to g_spawn_async
with G_SPAWN_SEARCH_PATH, so that it can report the user that it failed
to look up the command.

[1] http://bugzilla.gnome.org/show_bug.cgi?id=337014

-- 
Christian Neumair <chris gnome-de org>
Index: libgnomevfs/gnome-vfs-volume-ops.c
===================================================================
RCS file: /cvs/gnome/gnome-vfs/libgnomevfs/gnome-vfs-volume-ops.c,v
retrieving revision 1.30
diff -u -p -r1.30 gnome-vfs-volume-ops.c
--- libgnomevfs/gnome-vfs-volume-ops.c	6 Mar 2006 09:33:20 -0000	1.30
+++ libgnomevfs/gnome-vfs-volume-ops.c	7 Apr 2006 10:17:49 -0000
@@ -742,9 +742,9 @@ mount_unmount_thread (void *arg)
 
 			if (exit_status != 0) {
 				info->succeeded = FALSE;
-				if ((strcmp (info->argv[0], GNOME_VFS_BINDIR "/gnome-mount") == 0) ||
-				    (strcmp (info->argv[0], GNOME_VFS_BINDIR "/gnome-umount") == 0) ||
-				    (strcmp (info->argv[0], GNOME_VFS_BINDIR "/gnome-eject") == 0)) {
+				if ((strcmp (argv[0], GNOME_VFS_BINDIR "/gnome-mount") == 0) ||
+				    (strcmp (argv[0], GNOME_VFS_BINDIR "/gnome-umount") == 0) ||
+				    (strcmp (argv[0], GNOME_VFS_BINDIR "/gnome-eject") == 0)) {
 					/* gnome-mount programs display their own dialogs */
 					info->error_message = g_strdup ("");
 					info->detailed_error_message = g_strdup ("");


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