summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2006-10-16 02:08:17 +0000
committerMike Frysinger <vapier@gentoo.org>2006-10-16 02:08:17 +0000
commitd8d600b40020bf7733a0eeda542ff44bfc530a7c (patch)
tree53d7e613ab6d884fae37efc5ac56f4013f612ced /sys-apps/eject/files
parentMarking amd64 stable; cleaning up ebuilds (diff)
downloadgentoo-2-d8d600b40020bf7733a0eeda542ff44bfc530a7c.tar.gz
gentoo-2-d8d600b40020bf7733a0eeda542ff44bfc530a7c.tar.bz2
gentoo-2-d8d600b40020bf7733a0eeda542ff44bfc530a7c.zip
Handle spaces in mounts #151257 by Adam Goossens.
(Portage version: 2.1.2_pre2-r9)
Diffstat (limited to 'sys-apps/eject/files')
-rw-r--r--sys-apps/eject/files/digest-eject-2.1.5-r13
-rw-r--r--sys-apps/eject/files/eject-2.1.5-handle-spaces.patch57
2 files changed, 60 insertions, 0 deletions
diff --git a/sys-apps/eject/files/digest-eject-2.1.5-r1 b/sys-apps/eject/files/digest-eject-2.1.5-r1
new file mode 100644
index 000000000000..3b1ec4380258
--- /dev/null
+++ b/sys-apps/eject/files/digest-eject-2.1.5-r1
@@ -0,0 +1,3 @@
+MD5 b96a6d4263122f1711db12701d79f738 eject-2.1.5.tar.gz 123585
+RMD160 6e2f161e1399f9f01f376e56593d6ca586c4c8ea eject-2.1.5.tar.gz 123585
+SHA256 ef9f7906484cfde4ba223b2682a37058f9a3c7d3bb1adda7a34a67402e2ffe55 eject-2.1.5.tar.gz 123585
diff --git a/sys-apps/eject/files/eject-2.1.5-handle-spaces.patch b/sys-apps/eject/files/eject-2.1.5-handle-spaces.patch
new file mode 100644
index 000000000000..692368fa50b8
--- /dev/null
+++ b/sys-apps/eject/files/eject-2.1.5-handle-spaces.patch
@@ -0,0 +1,57 @@
+http://bugs.gentoo.org/151257
+
+--- eject.c
++++ eject.c
+@@ -370,6 +370,30 @@ static int FileExists(const char *name,
+
+
+ /*
++ * Linux mangles spaces in mount points by changing them to an octal string
++ * of '\040'. So lets scan the mount point and fix it up by replacing all
++ * occurrences off '\0##' with the ASCII value of 0##. Requires a writable
++ * string as input as we mangle in place. Some of this was taken from the
++ * util-linux package.
++ */
++#define octalify(a) ((a) & 7)
++#define tooctal(s) (64*octalify(s[1]) + 8*octalify(s[2]) + octalify(s[3]))
++#define isoctal(a) (((a) & ~7) == '0')
++static char *DeMangleMount(char *s)
++{
++ char *tmp = s;
++ while ((tmp = strchr(tmp, '\\')) != NULL) {
++ if (isoctal(tmp[1]) && isoctal(tmp[2]) && isoctal(tmp[3])) {
++ tmp[0] = tooctal(tmp);
++ memmove(tmp+1, tmp+4, strlen(tmp)-3);
++ }
++ ++tmp;
++ }
++ return s;
++}
++
++
++/*
+ * Given name, such as foo, see if any of the following exist:
+ *
+ * foo (if foo starts with '.' or '/')
+@@ -884,8 +908,8 @@ static int MountedDevice(const char *nam
+ if (((strcmp(s1, name) == 0) || (strcmp(s2, name) == 0)) ||
+ ((maj != -1) && (maj == mtabmaj) && (min == mtabmin))) {
+ FCLOSE(fp);
+- *deviceName = strdup(s1);
+- *mountName = strdup(s2);
++ *deviceName = DeMangleMount(strdup(s1));
++ *mountName = DeMangleMount(strdup(s2));
+ return 1;
+ }
+ }
+@@ -928,8 +952,8 @@ static int MountableDevice(const char *n
+ rc = sscanf(line, "%1023s %1023s", s1, s2);
+ if (rc >= 2 && s1[0] != '#' && strcmp(s2, name) == 0) {
+ FCLOSE(fp);
+- *deviceName = strdup(s1);
+- *mountName = strdup(s2);
++ *deviceName = DeMangleMount(strdup(s1));
++ *mountName = DeMangleMount(strdup(s2));
+ return 1;
+ }
+ }