summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Blake <eblake@redhat.com>2010-12-28 10:07:58 -0700
committerEric Blake <eblake@redhat.com>2010-12-29 11:48:15 -0700
commit85dc67887b7973790f63719d5a3b994bb980e790 (patch)
tree1cb30f0cb80f00218ea62d54a1fe97631f1bcf50
parent8129b787e22444055521ada1101aaaf8050c58a6 (diff)
downloadgnulib-85dc67887b7973790f63719d5a3b994bb980e790.tar.gz
mountlist: fix local drive detection on cygwin
* lib/mountlist.c (ME_REMOTE) [__CYGWIN__]: Provide implementation that works for cygwin. Signed-off-by: Eric Blake <eblake@redhat.com>
-rw-r--r--ChangeLog6
-rw-r--r--lib/mountlist.c24
2 files changed, 30 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 021102c7f2..f9aff45eb4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2010-12-29 Eric Blake <eblake@redhat.com>
+
+ mountlist: fix local drive detection on cygwin
+ * lib/mountlist.c (ME_REMOTE) [__CYGWIN__]: Provide implementation
+ that works for cygwin.
+
2010-12-29 Paul Eggert <eggert@cs.ucla.edu>
ftoastr, snprintf: ftoastr + snprintf module
diff --git a/lib/mountlist.c b/lib/mountlist.c
index 996b71a1f9..126f43ddc8 100644
--- a/lib/mountlist.c
+++ b/lib/mountlist.c
@@ -156,6 +156,30 @@
|| strcmp (Fs_type, "ignore") == 0)
#endif
+#ifdef __CYGWIN__
+# include <windows.h>
+# define ME_REMOTE me_remote
+/* All cygwin mount points include `:' or start with `//'; so it
+ requires a native Windows call to determine remote disks. */
+static bool
+me_remote (char const *fs_name, char const *fs_type _GL_UNUSED)
+{
+ if (fs_name[0] && fs_name[1] == ':')
+ {
+ char const drive[3] = { fs_name[0], ':', '\0' };
+ switch (GetDriveType (drive))
+ {
+ case DRIVE_REMOVABLE:
+ case DRIVE_FIXED:
+ case DRIVE_CDROM:
+ case DRIVE_RAMDISK:
+ return false;
+ }
+ }
+ return true;
+}
+#endif
+
#ifndef ME_REMOTE
/* A file system is `remote' if its Fs_name contains a `:'
or if (it is of type (smbfs or cifs) and its Fs_name starts with `//'). */