From 2e9a506a0442bc49267d84f0a6fa1b0ad8ccd6cd Mon Sep 17 00:00:00 2001 From: markm Date: Fri, 22 Feb 2002 21:11:03 +0000 Subject: Fix warnings inspired by lint, a commercial lint and WARNS=4. --- bin/hostname/hostname.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'bin/hostname') diff --git a/bin/hostname/hostname.c b/bin/hostname/hostname.c index 23171d6..7700bdd 100644 --- a/bin/hostname/hostname.c +++ b/bin/hostname/hostname.c @@ -83,8 +83,11 @@ main(int argc, char *argv[]) } else { if (gethostname(hostname, (int)sizeof(hostname))) err(1, "gethostname"); - if (sflag && (p = strchr(hostname, '.'))) - *p = '\0'; + if (sflag) { + p = strchr(hostname, '.'); + if (p != NULL) + *p = '\0'; + } (void)printf("%s\n", hostname); } exit(0); -- cgit v1.1