Page MenuHomeFreeBSD

D47672.diff
No OneTemporary

D47672.diff

diff --git a/contrib/netbsd-tests/lib/libc/sys/t_access.c b/contrib/netbsd-tests/lib/libc/sys/t_access.c
--- a/contrib/netbsd-tests/lib/libc/sys/t_access.c
+++ b/contrib/netbsd-tests/lib/libc/sys/t_access.c
@@ -38,11 +38,13 @@
#include <atf-c.h>
#include <sys/stat.h>
+#include <sys/sysctl.h>
#include <errno.h>
#include <fcntl.h>
#include <limits.h>
#include <stdint.h>
+#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
@@ -176,6 +178,38 @@
}
}
+ATF_TC(access_text);
+ATF_TC_HEAD(access_text, tc)
+{
+ atf_tc_set_md_var(tc, "descr", "Test access(2) for ETXTBSY");
+}
+
+ATF_TC_BODY(access_text, tc)
+{
+ char path[PATH_MAX];
+ size_t sz;
+ int fd, name[4];
+
+ name[0] = CTL_KERN;
+ name[1] = KERN_PROC;
+ name[2] = KERN_PROC_PATHNAME;
+ name[3] = -1;
+
+ sz = sizeof(path);
+ ATF_REQUIRE(sysctl(name, 4, path, &sz, NULL, 0) == 0);
+
+ fd = open(path, O_RDONLY);
+ ATF_REQUIRE(fd >= 0);
+
+ ATF_REQUIRE(access(path, W_OK) != 0);
+ ATF_REQUIRE(errno == ETXTBSY);
+
+ ATF_REQUIRE(faccessat(AT_FDCWD, path, W_OK, 0) != 0);
+ ATF_REQUIRE(errno == ETXTBSY);
+
+ ATF_REQUIRE(close(fd) == 0);
+}
+
ATF_TC(access_toolong);
ATF_TC_HEAD(access_toolong, tc)
{
@@ -214,6 +248,7 @@
ATF_TP_ADD_TC(tp, access_inval);
ATF_TP_ADD_TC(tp, access_notdir);
ATF_TP_ADD_TC(tp, access_notexist);
+ ATF_TP_ADD_TC(tp, access_text);
ATF_TP_ADD_TC(tp, access_toolong);
return atf_no_error();
diff --git a/sys/kern/vfs_default.c b/sys/kern/vfs_default.c
--- a/sys/kern/vfs_default.c
+++ b/sys/kern/vfs_default.c
@@ -1158,7 +1158,7 @@
vop_stdis_text(struct vop_is_text_args *ap)
{
- return (atomic_load_int(&ap->a_vp->v_writecount) < 0);
+ return ((int)atomic_load_int(&ap->a_vp->v_writecount) < 0);
}
int

File Metadata

Mime Type
text/plain
Expires
Fri, Jan 17, 6:51 PM (20 h, 53 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
15842073
Default Alt Text
D47672.diff (1 KB)

Event Timeline