Revision b928095b0a7cff7fb9fcf4c706348ceb8ab2c295 authored by Miklos Szeredi on 24 September 2014, 15:56:17 UTC, committed by Al Viro on 27 September 2014, 01:16:42 UTC
If overwriting an empty directory with rename, then need to drop the extra nlink. Test prog: #include <stdio.h> #include <fcntl.h> #include <err.h> #include <sys/stat.h> int main(void) { const char *test_dir1 = "test-dir1"; const char *test_dir2 = "test-dir2"; int res; int fd; struct stat statbuf; res = mkdir(test_dir1, 0777); if (res == -1) err(1, "mkdir(\"%s\")", test_dir1); res = mkdir(test_dir2, 0777); if (res == -1) err(1, "mkdir(\"%s\")", test_dir2); fd = open(test_dir2, O_RDONLY); if (fd == -1) err(1, "open(\"%s\")", test_dir2); res = rename(test_dir1, test_dir2); if (res == -1) err(1, "rename(\"%s\", \"%s\")", test_dir1, test_dir2); res = fstat(fd, &statbuf); if (res == -1) err(1, "fstat(%i)", fd); if (statbuf.st_nlink != 0) { fprintf(stderr, "nlink is %lu, should be 0\n", statbuf.st_nlink); return 1; } return 0; } Signed-off-by: Miklos Szeredi <mszeredi@suse.cz> Cc: stable@vger.kernel.org Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
1 parent 0f33be0
File | Mode | Size |
---|---|---|
include | ||
Kconfig | -rw-r--r-- | 6.8 KB |
Makefile | -rw-r--r-- | 1.6 KB |
Makefile.boot | -rw-r--r-- | 57 bytes |
avila-pci.c | -rw-r--r-- | 1.9 KB |
avila-setup.c | -rw-r--r-- | 4.6 KB |
common-pci.c | -rw-r--r-- | 11.1 KB |
common.c | -rw-r--r-- | 15.8 KB |
coyote-pci.c | -rw-r--r-- | 1.5 KB |
coyote-setup.c | -rw-r--r-- | 3.3 KB |
dsmg600-pci.c | -rw-r--r-- | 2.0 KB |
dsmg600-setup.c | -rw-r--r-- | 7.4 KB |
fsg-pci.c | -rw-r--r-- | 1.7 KB |
fsg-setup.c | -rw-r--r-- | 6.6 KB |
gateway7001-pci.c | -rw-r--r-- | 1.4 KB |
gateway7001-setup.c | -rw-r--r-- | 2.6 KB |
goramo_mlr.c | -rw-r--r-- | 12.4 KB |
gtwx5715-pci.c | -rw-r--r-- | 2.3 KB |
gtwx5715-setup.c | -rw-r--r-- | 4.6 KB |
ixdp425-pci.c | -rw-r--r-- | 1.8 KB |
ixdp425-setup.c | -rw-r--r-- | 7.3 KB |
ixdpg425-pci.c | -rw-r--r-- | 1.3 KB |
ixp4xx_npe.c | -rw-r--r-- | 21.2 KB |
ixp4xx_qmgr.c | -rw-r--r-- | 9.0 KB |
miccpt-pci.c | -rw-r--r-- | 1.8 KB |
nas100d-pci.c | -rw-r--r-- | 1.8 KB |
nas100d-setup.c | -rw-r--r-- | 8.1 KB |
nslu2-pci.c | -rw-r--r-- | 1.6 KB |
nslu2-setup.c | -rw-r--r-- | 7.0 KB |
omixp-setup.c | -rw-r--r-- | 6.2 KB |
vulcan-pci.c | -rw-r--r-- | 1.7 KB |
vulcan-setup.c | -rw-r--r-- | 6.0 KB |
wg302v2-pci.c | -rw-r--r-- | 1.4 KB |
wg302v2-setup.c | -rw-r--r-- | 2.5 KB |
![swh spinner](/static/img/swh-spinner.gif)
Computing file changes ...