Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(796)

Unified Diff: fusl/src/unistd/setxid.c

Issue 1714623002: [fusl] clang-format fusl (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: headers too Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: fusl/src/unistd/setxid.c
diff --git a/fusl/src/unistd/setxid.c b/fusl/src/unistd/setxid.c
index 0239f8afa95019ae9aa6dad5d79fcaf4eade139b..2695f6680d1b32e802da0953ef668504932874d0 100644
--- a/fusl/src/unistd/setxid.c
+++ b/fusl/src/unistd/setxid.c
@@ -5,35 +5,35 @@
#include "pthread_impl.h"
struct ctx {
- int id, eid, sid;
- int nr, err;
+ int id, eid, sid;
+ int nr, err;
};
-static void do_setxid(void *p)
-{
- struct ctx *c = p;
- if (c->err>0) return;
- int ret = -__syscall(c->nr, c->id, c->eid, c->sid);
- if (ret && !c->err) {
- /* If one thread fails to set ids after another has already
- * succeeded, forcibly killing the process is the only safe
- * thing to do. State is inconsistent and dangerous. Use
- * SIGKILL because it is uncatchable. */
- __block_all_sigs(0);
- __syscall(SYS_kill, __syscall(SYS_getpid), SIGKILL);
- }
- c->err = ret;
+static void do_setxid(void* p) {
+ struct ctx* c = p;
+ if (c->err > 0)
+ return;
+ int ret = -__syscall(c->nr, c->id, c->eid, c->sid);
+ if (ret && !c->err) {
+ /* If one thread fails to set ids after another has already
+ * succeeded, forcibly killing the process is the only safe
+ * thing to do. State is inconsistent and dangerous. Use
+ * SIGKILL because it is uncatchable. */
+ __block_all_sigs(0);
+ __syscall(SYS_kill, __syscall(SYS_getpid), SIGKILL);
+ }
+ c->err = ret;
}
-int __setxid(int nr, int id, int eid, int sid)
-{
- /* err is initially nonzero so that failure of the first thread does not
- * trigger the safety kill above. */
- struct ctx c = { .nr = nr, .id = id, .eid = eid, .sid = sid, .err = -1 };
- __synccall(do_setxid, &c);
- if (c.err) {
- if (c.err>0) errno = c.err;
- return -1;
- }
- return 0;
+int __setxid(int nr, int id, int eid, int sid) {
+ /* err is initially nonzero so that failure of the first thread does not
+ * trigger the safety kill above. */
+ struct ctx c = {.nr = nr, .id = id, .eid = eid, .sid = sid, .err = -1};
+ __synccall(do_setxid, &c);
+ if (c.err) {
+ if (c.err > 0)
+ errno = c.err;
+ return -1;
+ }
+ return 0;
}

Powered by Google App Engine
This is Rietveld 408576698