From a74247ab342814ccfd06748b6ba9b26dba2fc9d5 Mon Sep 17 00:00:00 2001 From: Charles Longeau Date: Fri, 5 Oct 2007 13:56:15 +0000 Subject: check fgets return value use strncmp instead of strcmp with help of ray@ "Looks OK" millert@ --- sbin/growfs/growfs.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'sbin/growfs') 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); } -- cgit v1.2.3