[network-manager-vpnc/nm-1-0] service: check write() return value to please compilers (bgo #743439)
- From: Jiří Klimeš <jklimes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [network-manager-vpnc/nm-1-0] service: check write() return value to please compilers (bgo #743439)
- Date: Thu, 11 Jun 2015 09:13:16 +0000 (UTC)
commit 583609a3233dc234244c92a04c94e25c2ffc3497
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
(cherry picked from commit 6013122268af839d6d7d08020db4ceab433bd477)
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 57fa268..1aa5a6e 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]