[PATCH app/xdm] Add missing brackets to multi-statement if in SaveServerAuthorizations

Alan Coopersmith alan.coopersmith at oracle.com
Sat May 5 19:33:12 UTC 2018


Introduced by commit 5222d28e8d8e5b4cc

Reported by gcc 7.3:

auth.c: In function ‘SaveServerAuthorizations’:
auth.c:447:6: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
      if (auths[i]->data_length > 0)
      ^~
auth.c:452:3: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
   (void) fflush (auth_file);
   ^

Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
---
 xdm/auth.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xdm/auth.c b/xdm/auth.c
index 068a643..1e5d8e9 100644
--- a/xdm/auth.c
+++ b/xdm/auth.c
@@ -442,21 +442,22 @@ SaveServerAuthorizations (
 	    /*
 	     * User-based auths may not have data until
 	     * a user logs in.  In which case don't write
 	     * to the auth file so xrdb and setup programs don't fail.
 	     */
-	    if (auths[i]->data_length > 0)
+	    if (auths[i]->data_length > 0) {
 		if (!XauWriteAuth (auth_file, auths[i]))
 		{
 		    Debug ("XauWriteAuth() failed\n");
 		}
 		(void) fflush (auth_file);
 		if (ferror (auth_file))
 		{
 		    err = errno;
 		    ret = FALSE;
 		}
+            }
 	}
 	/*
 	 * XXX: This is not elegant, but stdio has no truncation function.
 	 */
 	if (ftruncate(fileno(auth_file), ftell(auth_file)))
-- 
2.15.0



More information about the xorg-devel mailing list