aboutsummaryrefslogtreecommitdiff
path: root/bin/hostname/hostname.c
diff options
context:
space:
mode:
authorMark Murray <markm@FreeBSD.org>2002-02-22 21:11:03 +0000
committerMark Murray <markm@FreeBSD.org>2002-02-22 21:11:03 +0000
commit4b4ed2fe6ab53c01ba519b8ae401cda7e2358884 (patch)
treee65b01fd1720f56839eb9669f22e5f916c60255e /bin/hostname/hostname.c
parentfab912df88a4abeb6b7d0ee5a83b299d5d2ceb1d (diff)
downloadsrc-4b4ed2fe6ab53c01ba519b8ae401cda7e2358884.tar.gz
src-4b4ed2fe6ab53c01ba519b8ae401cda7e2358884.zip
Fix warnings inspired by lint, a commercial lint and WARNS=4.
Notes
Notes: svn path=/head/; revision=91084
Diffstat (limited to 'bin/hostname/hostname.c')
-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 23171d60ffae..7700bdde8a52 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);