From: Antoine Leca Date: Mon, 25 Oct 2010 17:03:36 +0000 (+0100) Subject: libc!setmode.c: Avoid #if inside macro call X-Git-Tag: v3.2.0~528 X-Git-Url: http://zhaoyanbai.com/repos/doc/mandoc_char.7.html?a=commitdiff_plain;h=6d8d7a88b273fc8d9e99d2ddc372d769d767d353;p=minix.git libc!setmode.c: Avoid #if inside macro call #if inside macro call is undefined behaviour under the C standard (3.8.3 paragraph 10 for C90, 6.8.10 paragraph 11 for C99). The same effect can be achieved with a slightly more verbose construct, putting the whole macro call inside the #ifdef/#else/#endif. --- diff --git a/lib/libc/other/setmode.c b/lib/libc/other/setmode.c index 3eb154cbf..1c4c4bffd 100644 --- a/lib/libc/other/setmode.c +++ b/lib/libc/other/setmode.c @@ -236,11 +236,11 @@ setmode(p) goto out; } perm = (mode_t)lval; - ADDCMD('=', (STANDARD_BITS #ifdef S_ISTXT - |S_ISTXT + ADDCMD('=', (STANDARD_BITS|S_ISTXT), perm, mask); +#else + ADDCMD('=', (STANDARD_BITS), perm, mask); #endif - ), perm, mask); set->cmd = 0; return (saveset); }