[network-manager-vpnc] service: check write() return value to please compilers (bgo #743439)



commit 6013122268af839d6d7d08020db4ceab433bd477
Author: Jiří Klimeš <jklimes redhat com>
Date:   Thu Jun 11 11:07:37 2015 +0200

    service: check write() return value to please compilers (bgo #743439)
    
    See also:
    https://gcc.gnu.org/bugzilla/show_bug.cgi?id=25509
    https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66425
    
    https://bugzilla.gnome.org/show_bug.cgi?id=743439

 src/nm-vpnc-service.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/src/nm-vpnc-service.c b/src/nm-vpnc-service.c
index 3c9327b..4e7b9bb 100644
--- a/src/nm-vpnc-service.c
+++ b/src/nm-vpnc-service.c
@@ -658,6 +658,8 @@ write_config_option (int fd, const char *format, ...)
        va_start (args, format);
        string = g_strdup_vprintf (format, args);
        x = write (fd, string, strlen (string));
+       if (x < 0)
+               g_warning ("Unexpected error in write(): %d", errno);
 
        if (debug)
                g_print ("Config: %s", string);
@@ -883,9 +885,10 @@ _connect_common (NMVPNPlugin   *plugin,
        if (!nm_vpnc_config_write (priv->infd, s_con, s_vpn, error))
                goto out;
 
-       if (interactive)
-               write (priv->infd, &end, sizeof (end));
-       else {
+       if (interactive) {
+               if (write (priv->infd, &end, sizeof (end)) < 0)
+                       g_warning ("Unexpected error in write(): %d", errno);
+       } else {
                close (priv->infd);
                priv->infd = -1;
        }


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