Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F147039949
D55484.id172585.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D55484.id172585.diff
View Options
diff --git a/lib/libc/stdlib/system.c b/lib/libc/stdlib/system.c
--- a/lib/libc/stdlib/system.c
+++ b/lib/libc/stdlib/system.c
@@ -65,7 +65,7 @@
pid_t pid;
if (command == NULL) /* just checking... */
- return(1);
+ return (eaccess(_PATH_BSHELL, X_OK) == 0);
/*
* If we are the first concurrent instance, ignore SIGINT and
diff --git a/lib/libc/tests/stdlib/system_test.c b/lib/libc/tests/stdlib/system_test.c
--- a/lib/libc/tests/stdlib/system_test.c
+++ b/lib/libc/tests/stdlib/system_test.c
@@ -57,10 +57,20 @@
ATF_TC_HEAD(system_null, tc)
{
atf_tc_set_md_var(tc, "descr", "system(NULL)");
+ atf_tc_set_md_var(tc, "require.user", "root");
}
ATF_TC_BODY(system_null, tc)
{
+ /* First, test in a normal environment */
ATF_REQUIRE_EQ(1, system(NULL));
+
+ /* Now enter an empty chroot */
+ ATF_REQUIRE_EQ(0, chroot("."));
+ ATF_REQUIRE_EQ(0, chdir("/"));
+
+ /* Test again with no shell available */
+ ATF_REQUIRE_EQ(0, system(NULL));
+ ATF_REQUIRE_EQ(W_EXITCODE(127, 0), system("true"));
}
static void *
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Mar 8, 8:13 PM (16 h, 6 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29415786
Default Alt Text
D55484.id172585.diff (1 KB)
Attached To
Mode
D55484: system(3): Fix null case
Attached
Detach File
Event Timeline
Log In to Comment