From 2b651b469e7b31d26999947dfc3234213d164dee Mon Sep 17 00:00:00 2001 From: Jesse Smith Date: Wed, 21 Feb 2018 18:05:58 -0400 Subject: [PATCH] Fixed Clang compiler warning when calling sprintf() with variable number of data parameters. --- doc/Changelog | 2 ++ src/dowall.c | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/doc/Changelog b/doc/Changelog index b4c2b87..a8be14e 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -1,6 +1,8 @@ sysvinit (2.89) UNRELEASED; urgency=low [ Jesse Smith ] + * Fixed Clang compiler warning regarding variable data parameters to sprintf(). + * Updated top-level Makefile to work with git repo instead of old svn repo. * Removed unused variables and findtty() function in bootlogd * Add checks to return code for fscanf() called in init.c. This mostly just cleans up compiler warnings. diff --git a/src/dowall.c b/src/dowall.c index 85645c0..8f4c614 100644 --- a/src/dowall.c +++ b/src/dowall.c @@ -96,7 +96,14 @@ static void getuidtty(char **userp, char **ttyp) uidbuf[0] = 0; strncat(uidbuf, pwd->pw_name, sizeof(uidbuf) - 1); } else { + /* Using variable number of data parameters in one + function makes the Clang compiler cry. -- Jesse sprintf(uidbuf, uid ? "uid %d" : "root", (int)uid); + */ + if (uid) + sprintf(uidbuf, "uid %d", (int) uid); + else + sprintf(uidbuf, "root"); } if ((tty = ttyname(0)) != NULL) {