As imposed by POSIX.
Extend a random test to verify this behavior.
Change-Id: Ib70550cefaeb9efd54e22312425263a5606fb5e8
mode_bits = job_m_in.m_lc_vfs_mknod.mode;
dev = job_m_in.m_lc_vfs_mknod.device;
- lookup_init(&resolve, fullpath, PATH_NOFLAGS, &vmp, &vp);
+ /* If the path names a symbolic link, mknod() shall fail with EEXIST. */
+ lookup_init(&resolve, fullpath, PATH_RET_SYMLINK, &vmp, &vp);
resolve.l_vmnt_lock = VMNT_WRITE;
resolve.l_vnode_lock = VNODE_WRITE;
/* Cleanup created files */
if (unlink(slink_to) == -1) e(18);
- if (unlink("a") == -1) e(19);
- if (unlink("c") == -1) e(20);
+ if (unlink("c") == -1) e(19);
+
+ /* Use the dangling symlink to test mknod(2) following symlinks */
+ if (mknod("a", S_IFCHR | 0777, makedev(1, 1)) != -1) e(20);
+ if (errno != EEXIST) e(21);
+ if (unlink("a") == -1) e(22);
exit(EXIT_SUCCESS);
} else {