[glib: 2/6] gio-tool-mount: Exit with error in case we can't read from stdin




commit a5390002fc0805fd6c3827e737d39c99979ba1b0
Author: Marco Trevisan (TreviƱo) <mail 3v1n0 net>
Date:   Wed Jul 6 16:04:47 2022 +0200

    gio-tool-mount: Exit with error in case we can't read from stdin
    
    It's a fatal situation so we can just exit without caring much.

 gio/gio-tool-mount.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
---
diff --git a/gio/gio-tool-mount.c b/gio/gio-tool-mount.c
index 7ab36c1254..4d4a45092e 100644
--- a/gio/gio-tool-mount.c
+++ b/gio/gio-tool-mount.c
@@ -112,7 +112,8 @@ prompt_for (const char *prompt, const char *default_value, gboolean echo)
 
 #endif
 
-  fgets(data, sizeof (data), stdin);
+  if (!fgets (data, sizeof (data), stdin))
+    g_error ("Failed to read from standard input");
 
 #ifdef HAVE_TERMIOS_H
   if (restore_flags)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]