diff options
author | Christopher Faylor <me@cgf.cx> | 2003-07-26 05:38:51 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2003-07-26 05:38:51 +0000 |
commit | 035df9eff5ad116d40599db4ebf9dd8e51734b9c (patch) | |
tree | 1065d84583384f4a3e43da3f84e9908f8704cc23 /winsup/utils/mount.cc | |
parent | df04ae29b258b89bbd4991bd862a03ac56430e4e (diff) | |
download | newlib-035df9eff5ad116d40599db4ebf9dd8e51734b9c.zip newlib-035df9eff5ad116d40599db4ebf9dd8e51734b9c.tar.gz newlib-035df9eff5ad116d40599db4ebf9dd8e51734b9c.tar.bz2 |
* mount.cc (do_mount): Issue warning when using managed mount option on
non-empty directory.
Diffstat (limited to 'winsup/utils/mount.cc')
-rw-r--r-- | winsup/utils/mount.cc | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/winsup/utils/mount.cc b/winsup/utils/mount.cc index 0cce584..2a70149 100644 --- a/winsup/utils/mount.cc +++ b/winsup/utils/mount.cc @@ -16,6 +16,7 @@ details. */ #include <sys/cygwin.h> #include <stdlib.h> #include <getopt.h> +#include <dirent.h> #ifdef errno #undef errno @@ -104,6 +105,25 @@ do_mount (const char *dev, const char *where, int flags) } } + if (!force && flags & MOUNT_ENC) + { + DIR *dd = opendir (dev); + if (dd) + { + struct dirent *d; + while ((d = readdir (dd))) + { + if (d->d_name[0] != '.') + /* fall through */; + else if (d->d_name[1] == '\0' + || (d->d_name[1] == '.' && d->d_name[2] == '\0')) + continue; + fprintf (stderr, "%s: error: don't use \"-o managed\" on non-empty directories\n", progname); + exit (1); + } + } + } + if (mount (dev, where, flags)) error (where); |