patches/gnome-utils-01-gfloppy-permission.diff
author dc144907
Tue, 25 Jul 2006 13:27:49 +0000
changeset 7752 4abd61edfaf7
child 8374 2cfb28a10268
permissions -rw-r--r--
2006-07-25 Damien Carbery <[email protected]> * vte.spec: Remove upstream patch, 05-update-logout-record. Rename rest. * patches/vte-05-update-logout-record.diff: Removed, upstream. * gnome-utils.spec: Remove upstream patchs. Renumber rest. * patches/gnome-utils-01-logview.diff: Removed, upstream. * patches/gnome-utils-04-gnome-dictionary.diff: Removed, upstream. * patches/gnome-utils-02-gnome-screenshot.diff: Rework. * patches/gnome-utils-03-search-menu-entry.diff: Rework.

diff -urNp gnome-utils-2.12.0/gfloppy/src/gfloppy.c gnome-utils-2.12.0-hacked/gfloppy/src/gfloppy.c
--- gnome-utils-2.12.0/gfloppy/src/gfloppy.c	2005-07-20 11:15:40.000000000 +1200
+++ gnome-utils-2.12.0-hacked/gfloppy/src/gfloppy.c	2005-09-18 19:53:06.089895752 +1200
@@ -27,6 +27,7 @@
 #include <string.h>
 #include <stdio.h>
 #include <unistd.h>
+#include <mntent.h>
 
 #ifdef HAVE_LINUX_FD_H
 #include <linux/fd.h>
@@ -441,6 +442,36 @@ execute_mbadblocks (GFloppy *floppy)
 }
 
 static int
+change_permission (char *device)
+{
+	struct mntent *ent;
+	FILE *fp;
+	char *mntdir = NULL;
+	int ret = -1;
+
+	fp = setmntent (_PATH_MOUNTED, "r");
+
+	if (fp) {
+		while ((ent = getmntent (fp))) {
+			if (!strcmp (ent->mnt_fsname, device))
+				mntdir = g_strdup (ent->mnt_dir);
+		}
+	}
+
+	endmntent (fp);
+
+	if (mntdir) {
+		int fd;
+		fd = open (mntdir, 0);
+		ret = fchmod (fd, S_IRWXU|S_IRWXG|S_IRWXO);
+		close (fd);
+		g_free (mntdir);
+	}
+
+	return ret;
+}
+
+static int
 format_ext2fs (GFloppy *floppy)
 {
 	gint rc = 0;
@@ -474,6 +505,8 @@ format_ext2fs (GFloppy *floppy)
 		return -1;
 	}
 
+	change_permission (floppy->device);
+
 	fd_print (floppy, MSG_MESSAGE, _("Making filesystem on disk... Done"));
 	fd_print (floppy, MSG_PROGRESS, "100");