Fixed Clang compiler warning when calling sprintf() with

variable number of data parameters.
This commit is contained in:
Jesse Smith 2018-02-21 18:05:58 -04:00
parent e1ab5f1528
commit 2b651b469e
2 changed files with 9 additions and 0 deletions

View File

@ -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.

View File

@ -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) {