summaryrefslogtreecommitdiff
path: root/sbin/growfs
diff options
context:
space:
mode:
authorCharles Longeau <chl@cvs.openbsd.org>2007-10-05 13:56:15 +0000
committerCharles Longeau <chl@cvs.openbsd.org>2007-10-05 13:56:15 +0000
commita74247ab342814ccfd06748b6ba9b26dba2fc9d5 (patch)
tree77388c4aaea1848cc2da094ffb3e632331e09dd9 /sbin/growfs
parent5faae98cfba3a5a99034bb76d995cd5159cb6a1f (diff)
check fgets return value
use strncmp instead of strcmp with help of ray@ "Looks OK" millert@
Diffstat (limited to 'sbin/growfs')
-rw-r--r--sbin/growfs/growfs.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sbin/growfs/growfs.c b/sbin/growfs/growfs.c
index 096f5cb9533..fa0dd087dd9 100644
--- a/sbin/growfs/growfs.c
+++ b/sbin/growfs/growfs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: growfs.c,v 1.22 2007/09/02 23:50:03 deraadt Exp $ */
+/* $OpenBSD: growfs.c,v 1.23 2007/10/05 13:56:14 chl Exp $ */
/*
* Copyright (c) 2000 Christoph Herrmann, Thomas-Henning von Kamptz
* Copyright (c) 1980, 1989, 1993 The Regents of the University of California.
@@ -2061,8 +2061,8 @@ main(int argc, char **argv)
printf("We strongly recommend you to make a backup "
"before growing the Filesystem\n\n"
" Did you backup your data (Yes/No) ? ");
- fgets(reply, (int)sizeof(reply), stdin);
- if (strcmp(reply, "Yes\n")) {
+ if (fgets(reply, (int)sizeof(reply), stdin) == NULL ||
+ strncmp(reply, "Yes", 3)) {
printf("\n Nothing done \n");
exit (0);
}