* libmisc/obscure.c, lib/prototypes.h (obscure): Return a bool
instead of an int. * libmisc/obscure.c, libmisc/tz.c, src/passwd.c, lib/encrypt.c, libmisc/copydir.c, lib/prototypes.h: Add splint annotations. * libmisc/tz.c: Fix some const issues. * libmisc/tz.c: Avoid multi-statements lines. * libmisc/tz.c: Add brackets. * libmisc/copydir.c: Do not check *printf/*puts return value. * libmisc/copydir.c: Fail if we cannot set or reset the SELinux fscreate context. * libmisc/copydir.c: Use xmalloc instead of malloc. * libmisc/copydir.c: Do not check lutimes return value * src/vipw.c: Avoid implicit conversion of integer to boolean. * src/su.c (iswheel): Return a bool instead of an int. * src/passwd.c: Remove insert_crypt_passwd(). Use xstrdup instead. * src/passwd.c: Return constant strings when sufficient. * src/passwd.c: Do not check *printf/*puts return value. * src/passwd.c: Avoid implicit conversion of character to boolean. * src/passwd.c: Do not check sleep return value. * src/sulogin.c: Do not check *printf/*puts return value. * lib/encrypt.c: Do not check fprintf return value.
This commit is contained in:
+12
-7
@@ -49,23 +49,28 @@
|
||||
* tz() determines the name of the local timezone by reading the
|
||||
* contents of the file named by ``fname''.
|
||||
*/
|
||||
char *tz (const char *fname)
|
||||
/*@observer@*/const char *tz (const char *fname)
|
||||
{
|
||||
FILE *fp = 0;
|
||||
FILE *fp = NULL;
|
||||
static char tzbuf[BUFSIZ];
|
||||
const char *def_tz = "TZ=CST6CDT";
|
||||
|
||||
if ((fp = fopen (fname, "r")) == NULL ||
|
||||
fgets (tzbuf, (int) sizeof (tzbuf), fp) == NULL) {
|
||||
if (!(def_tz = getdef_str ("ENV_TZ")) || def_tz[0] == '/')
|
||||
fp = fopen (fname, "r");
|
||||
if ( (NULL == fp)
|
||||
|| (fgets (tzbuf, (int) sizeof (tzbuf), fp) == NULL)) {
|
||||
def_tz = getdef_str ("ENV_TZ");
|
||||
if ((NULL == def_tz) || ('/' == def_tz[0])) {
|
||||
def_tz = "TZ=CST6CDT";
|
||||
}
|
||||
|
||||
strcpy (tzbuf, def_tz);
|
||||
} else
|
||||
} else {
|
||||
tzbuf[strlen (tzbuf) - 1] = '\0';
|
||||
}
|
||||
|
||||
if (fp)
|
||||
if (NULL != fp) {
|
||||
(void) fclose (fp);
|
||||
}
|
||||
|
||||
return tzbuf;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user