aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/mach/hurd/mknodat.c
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/mach/hurd/mknodat.c')
-rw-r--r--sysdeps/mach/hurd/mknodat.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/sysdeps/mach/hurd/mknodat.c b/sysdeps/mach/hurd/mknodat.c
index 13f2191..c1fe343 100644
--- a/sysdeps/mach/hurd/mknodat.c
+++ b/sysdeps/mach/hurd/mknodat.c
@@ -88,8 +88,12 @@ __mknodat (int fd, const char *path, mode_t mode, dev_t dev)
if (dir == MACH_PORT_NULL)
return -1;
- /* Create a new, unlinked node in the target directory. */
- errnode = err = __dir_mkfile (dir, O_WRITE, (mode & ~S_IFMT) & ~_hurd_umask, &node);
+ if (! *name)
+ /* Can't link to the existing directory itself. */
+ errnode = err = ENOTDIR;
+ else
+ /* Create a new, unlinked node in the target directory. */
+ errnode = err = __dir_mkfile (dir, O_WRITE, (mode & ~S_IFMT) & ~_hurd_umask, &node);
if (! err && translator != NULL)
/* Set the node's translator to make it a device. */