summaryrefslogtreecommitdiffstats
path: root/bin/hostname
diff options
context:
space:
mode:
authormarkm <markm@FreeBSD.org>2002-02-22 21:11:03 +0000
committermarkm <markm@FreeBSD.org>2002-02-22 21:11:03 +0000
commit2e9a506a0442bc49267d84f0a6fa1b0ad8ccd6cd (patch)
treee65b01fd1720f56839eb9669f22e5f916c60255e /bin/hostname
parent02fae8d816882e45cd68528d586dbb54fdeb7f65 (diff)
downloadFreeBSD-src-2e9a506a0442bc49267d84f0a6fa1b0ad8ccd6cd.zip
FreeBSD-src-2e9a506a0442bc49267d84f0a6fa1b0ad8ccd6cd.tar.gz
Fix warnings inspired by lint, a commercial lint and WARNS=4.
Diffstat (limited to 'bin/hostname')
-rw-r--r--bin/hostname/hostname.c7
1 files changed, 5 insertions, 2 deletions
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);
OpenPOWER on IntegriCloud