changeset 1545:f02908cec744

check for fgets() return value - avoids a warning
author Jorge Arellano Cid <jcid@dillo.org>
date Tue, 02 Feb 2010 21:23:08 +0100
parents a481f493116e
children afe20c3687f2
files dpid/dpidc.c
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/dpid/dpidc.c	Fri Jan 29 12:09:19 2010 +0100
+++ b/dpid/dpidc.c	Tue Feb 02 21:23:08 2010 +0100
@@ -98,7 +98,8 @@
     } else if (strcmp(argv[1], "chat") == 0) {
        printf("Please enter the message: ");
        bzero(buffer,256);
-       fgets(buffer,255,stdin);
+       if (fgets(buffer,255,stdin) == NULL)
+          MSG_ERR("dpidc: Can't read the message\n");
     } else {
        MSG_ERR("main: Unknown operation '%s'\n", argv[1]);
        print_usage(argv[0]);