From: Fabrice Bellard Date: Mon, 1 Jun 2026 16:47:42 +0000 (+0200) Subject: fixed setuid() / setgid() ordering (#517) X-Git-Url: http://git.kaiwu.me/postgresql/log/contrib/postgres_fdw/stylesheets/print.css?a=commitdiff_plain;h=4a13c45081cfcbaa1ba738c05db1ea4d5f99c73f;p=quickjs.git fixed setuid() / setgid() ordering (#517) --- diff --git a/quickjs-libc.c b/quickjs-libc.c index de860f7..bd671b6 100644 --- a/quickjs-libc.c +++ b/quickjs-libc.c @@ -3305,14 +3305,14 @@ static JSValue js_os_exec(JSContext *ctx, JSValueConst this_val, if (chdir(cwd) < 0) _exit(127); } - if (uid != -1) { - if (setuid(uid) < 0) - _exit(127); - } if (gid != -1) { if (setgid(gid) < 0) _exit(127); } + if (uid != -1) { + if (setuid(uid) < 0) + _exit(127); + } if (!file) file = exec_argv[0];