* mount.cc (do_mount): Issue warning when using managed mount option on
non-empty directory.
This commit is contained in:
parent
df04ae29b2
commit
035df9eff5
@ -1,3 +1,8 @@
|
||||
2003-07-26 Christopher Faylor <cgf@redhat.com>
|
||||
|
||||
* mount.cc (do_mount): Issue warning when using managed mount option on
|
||||
non-empty directory.
|
||||
|
||||
2003-07-25 Christopher Faylor <cgf@redhat.com>
|
||||
|
||||
* configure.in: Use 'install-sh -c'.
|
||||
|
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user