mirror of
https://github.com/clearlinux/uwsgi.git
synced 2026-08-21 21:17:43 +00:00
lib/linux_ns: check mkdir() return value
Fail earlier if we can't create the dirs we need. Reported by Coverity as CID #970969.
This commit is contained in:
+8
-2
@@ -132,10 +132,16 @@ void linux_namespace_jail() {
|
||||
|
||||
if (strcmp(uwsgi.ns, "/")) {
|
||||
ns_tmp_mountpoint = uwsgi_concat2(uwsgi.ns, "/.uwsgi_ns_tmp_mountpoint");
|
||||
mkdir(ns_tmp_mountpoint, S_IRWXU);
|
||||
if (mkdir(ns_tmp_mountpoint, S_IRWXU) < 0) {
|
||||
uwsgi_error("mkdir() ns_tmp_mountpoint");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
ns_tmp_mountpoint2 = uwsgi_concat2(ns_tmp_mountpoint, "/.uwsgi_ns_tmp_mountpoint");
|
||||
mkdir(ns_tmp_mountpoint2, S_IRWXU);
|
||||
if (mkdir(ns_tmp_mountpoint2, S_IRWXU) < 0) {
|
||||
uwsgi_error("mkdir() ns_tmp_mountpoint2");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (mount(uwsgi.ns, ns_tmp_mountpoint, "none", MS_BIND, NULL)) {
|
||||
uwsgi_error("mount()");
|
||||
|
||||
Reference in New Issue
Block a user