[pkg-fso-commits] [nodm] 35/50: xserver.c: Don't FTBFS when built with -Werror=unused-result. (Closes: #638600).

Mike Gabriel sunweaver at debian.org
Mon Jan 23 15:19:33 UTC 2017


This is an automated email from the git hooks/post-receive script.

sunweaver pushed a commit to branch master
in repository nodm.

commit 71acb3af3187bf7736c7b11fc7314a0825978dcc
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date:   Wed Mar 23 15:32:17 2016 +0100

    xserver.c: Don't FTBFS when built with  -Werror=unused-result. (Closes: #638600).
    
    Amends these compiler errors when doing a hardened build:
    
    ```
    xserver.c: In function 'nodm_xserver_read_window_path':
    xserver.c:413:9: error: ignoring return value of 'asprintf', declared with attribute warn_unused_result [-Werror=unused-result]
             asprintf(&newwindowpath, "%lu", num);
             ^
    xserver.c:415:9: error: ignoring return value of 'asprintf', declared with attribute warn_unused_result [-Werror=unused-result]
             asprintf(&newwindowpath, "%s:%lu", windowpath, num);
             ^
    ```
---
 debian/changelog |  2 ++
 xserver.c        | 14 +++++++++-----
 2 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 3c87645..695d248 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -22,6 +22,8 @@ nodm (0.12-1) UNRELEASED; urgency=low
     - Drop .gitignore file. Let's rather provide a working make (dist)clean.
     - Makefile.am: line-wrap variable assignments with file lists.
     - Makefile.am: Add various build cruft files to DISTCLEANFILES.
+    - xserver.c: Don't FTBFS when built with -Werror=unused-result. (Closes:
+      #638600).
   * debian/control:
     + Process with wrap-and-sort.
     + Bump Standards: to 3.9.7. Required change: DEP-5 compliant copyright file.
diff --git a/xserver.c b/xserver.c
index 455db2f..a81367f 100644
--- a/xserver.c
+++ b/xserver.c
@@ -409,13 +409,17 @@ int nodm_xserver_read_window_path(struct nodm_xserver* srv)
     }
     XFree(buf);
     windowpath = getenv("WINDOWPATH");
+
+    int path_size;
     if (!windowpath)
-        asprintf(&newwindowpath, "%lu", num);
+        path_size = asprintf(&newwindowpath, "%lu", num);
     else
-        asprintf(&newwindowpath, "%s:%lu", windowpath, num);
-    if (srv->windowpath) free(srv->windowpath);
-    srv->windowpath = newwindowpath;
-    log_verb("WINDOWPATH: %s", srv->windowpath);
+        path_size = asprintf(&newwindowpath, "%s:%lu", windowpath, num);
+    if (path_size > 0) {
+        if (srv->windowpath) free(srv->windowpath);
+        srv->windowpath = newwindowpath;
+        log_verb("WINDOWPATH: %s", srv->windowpath);
+    }
 
     return E_SUCCESS;
 }

-- 
Alioth's hooks/post-receive on /srv/git.debian.org/git/pkg-fso/nodm.git



More information about the pkg-fso-commits mailing list