The Samba-Bugzilla – Attachment 3148 Details for
Bug 4370
umount.cfis does not remove mtab entry for relative links
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
patch to unmount cifs filesytem with entry in /etc/mtab removed
umount.cifs.patch (text/plain), 1.78 KB, created by
shirishpargaonkar@gmail.com
on 2008-02-25 11:35:06 UTC
(
hide
)
Description:
patch to unmount cifs filesytem with entry in /etc/mtab removed
Filename:
MIME Type:
Creator:
shirishpargaonkar@gmail.com
Created:
2008-02-25 11:35:06 UTC
Size:
1.78 KB
patch
obsolete
>--- client.orig/umount.cifs.c 2008-02-22 05:58:37.000000000 -0600 >+++ client/umount.cifs.c 2008-02-25 08:15:29.000000000 -0600 >@@ -34,6 +34,7 @@ > #include <errno.h> > #include <string.h> > #include <mntent.h> >+#include <limits.h> > > #define UNMOUNT_CIFS_VERSION_MAJOR "0" > #define UNMOUNT_CIFS_VERSION_MINOR "5" >@@ -69,6 +70,8 @@ > #define CIFS_IOC_CHECKUMOUNT _IO(0xCF, 2) > #define CIFS_MAGIC_NUMBER 0xFF534D42 /* the first four bytes of SMB PDU */ > >+#define streq(s, t)(strcmp ((s), (t)) == 0) >+ > static struct option longopts[] = { > { "all", 0, NULL, 'a' }, > { "help",0, NULL, 'h' }, >@@ -248,6 +251,46 @@ static int remove_from_mtab(char * mount > return rc; > } > >+char * >+xstrdup(const char *s) { >+ char *t; >+ >+ if (s == NULL) >+ return NULL; >+ >+ t = strdup(s); >+ >+ if (t == NULL) { >+ fprintf(stderr, "not enough memory"); >+ exit(1); >+ } >+ >+ return t; >+} >+ >+/* Make a canonical pathname from PATH. Returns a freshly malloced string. >+ It is up the *caller* to ensure that the PATH is sensible. i.e. >+ canonicalize ("/dev/fd0/.") returns "/dev/fd0" even though ``/dev/fd0/.'' >+ is not a legal pathname for ``/dev/fd0''. Anything we cannot parse >+ we return unmodified. */ >+char * >+canonicalize(const char *path) { >+ char canonical[PATH_MAX+2]; >+ >+ if (path == NULL) >+ return NULL; >+#if 1 >+ if (streq(path, "null") || >+ streq(path, "proc") || >+ streq(path, "devpts")) >+ return (xstrdup(path)); >+#endif >+ if (realpath(path, canonical)) >+ return xstrdup(canonical); >+ >+ return xstrdup(path); >+} >+ > int main(int argc, char ** argv) > { > int c; >@@ -321,7 +364,7 @@ int main(int argc, char ** argv) > argv += optind; > argc -= optind; > >- mountpoint = argv[0]; >+ mountpoint = canonicalize(argv[0]); > > if((argc < 1) || (argv[0] == NULL)) { > printf("\nMissing name of unmount directory\n");
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 4370
:
3143
| 3148 |
3905
|
3906