SCCS-vsn: sbin/mount_union/mount_union.c 8.3
SCCS-vsn: sbin/mount_null/mount_null.c 8.4
SCCS-vsn: old/mount_lofs/mount_lofs.c 8.3
*
* %sccs.include.redist.c%
*
*
* %sccs.include.redist.c%
*
- * @(#)mount_lofs.c 8.2 (Berkeley) %G%
+ * @(#)mount_lofs.c 8.3 (Berkeley) %G%
*/
#include <sys/param.h>
*/
#include <sys/param.h>
#include <stdlib.h>
#include <string.h>
#include <stdlib.h>
#include <string.h>
-static int subdir __P((char *, char *));
+static int subdir __P((const char *, const char *));
void usage __P((void));
int
void usage __P((void));
int
- if (subdir(target, argv[1])) {
+ if (subdir(target, argv[1]) || subdir(argv[1], target)) {
- "mount_lofs: %s (%s) is a sub directory of %s\n",
+ "mount_lofs: %s (%s) and %s are not distinct paths\n",
argv[0], target, argv[1]);
exit(1);
}
argv[0], target, argv[1]);
exit(1);
}
static int
subdir(p, dir)
static int
subdir(p, dir)
+ const char *p;
+ const char *dir;
- if ((strncmp(p, dir, l) == 0) && (p[l] == '/'))
+ if ((strncmp(p, dir, l) == 0) && (p[l] == '/' || p[l] == '\0'))
*
* %sccs.include.redist.c%
*
*
* %sccs.include.redist.c%
*
- * @(#)mount_null.c 8.3 (Berkeley) %G%
+ * @(#)mount_null.c 8.4 (Berkeley) %G%
*/
#include <sys/param.h>
*/
#include <sys/param.h>
#include <stdlib.h>
#include <string.h>
#include <stdlib.h>
#include <string.h>
-static int subdir __P((char *, char *));
+static int subdir __P((const char *, const char *));
void usage __P((void));
int
void usage __P((void));
int
- if (subdir(target, argv[1])) {
+ if (subdir(target, argv[1]) || subdir(argv[1], target)) {
- "mount_null: %s (%s) is a sub directory of %s\n",
+ "mount_null: %s (%s) and %s are not distinct paths\n",
argv[0], target, argv[1]);
exit(1);
}
argv[0], target, argv[1]);
exit(1);
}
static int
subdir(p, dir)
static int
subdir(p, dir)
+ const char *p;
+ const char *dir;
- if ((strncmp(p, dir, l) == 0) && (p[l] == '/'))
+ if ((strncmp(p, dir, l) == 0) && (p[l] == '/' || p[l] == '\0'))
*
* %sccs.include.redist.c%
*
*
* %sccs.include.redist.c%
*
- * @(#)mount_union.c 8.2 (Berkeley) %G%
+ * @(#)mount_union.c 8.3 (Berkeley) %G%
*/
#include <sys/param.h>
*/
#include <sys/param.h>
#include <stdlib.h>
#include <string.h>
#include <stdlib.h>
#include <string.h>
-static int subdir __P((char *, char *));
+static int subdir __P((const char *, const char *));
void usage __P((void));
int
void usage __P((void));
int
- if (subdir(target, argv[1])) {
+ if (subdir(target, argv[1]) || subdir(argv[1], target)) {
- "mount_union: %s is a sub-directory of %s\n",
- argv[0], argv[1]);
+ "mount_union: %s (%s) and %s are not distinct paths\n",
+ argv[0], target, argv[1]);
static int
subdir(p, dir)
static int
subdir(p, dir)
+ const char *p;
+ const char *dir;
- if ((strncmp(p, dir, l) == 0) && (p[l] == '/'))
+ if ((strncmp(p, dir, l) == 0) && (p[l] == '/' || p[l] == '\0'))