summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/glib-2.0/glib-2.0/0001-Do-not-ignore-return-value-of-write.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-core/glib-2.0/glib-2.0/0001-Do-not-ignore-return-value-of-write.patch')
-rw-r--r--meta/recipes-core/glib-2.0/glib-2.0/0001-Do-not-ignore-return-value-of-write.patch42
1 files changed, 42 insertions, 0 deletions
diff --git a/meta/recipes-core/glib-2.0/glib-2.0/0001-Do-not-ignore-return-value-of-write.patch b/meta/recipes-core/glib-2.0/glib-2.0/0001-Do-not-ignore-return-value-of-write.patch
new file mode 100644
index 0000000000..aee96aaa6e
--- /dev/null
+++ b/meta/recipes-core/glib-2.0/glib-2.0/0001-Do-not-ignore-return-value-of-write.patch
@@ -0,0 +1,42 @@
1From d6501b107940e9f548c89236d773c6d33c15a5c9 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Sat, 16 Apr 2016 13:28:59 -0700
4Subject: [PATCH 1/2] Do not ignore return value of write()
5
6gcc warns about ignoring return value when compiling
7with fortify turned on.
8
9assert when write() fails
10
11Signed-off-by: Khem Raj <raj.khem@gmail.com>
12---
13Upstream-Status: Submitted
14
15 glib/tests/unix.c | 5 +++--
16 1 file changed, 3 insertions(+), 2 deletions(-)
17
18diff --git a/glib/tests/unix.c b/glib/tests/unix.c
19index 3543458..4e7ed85 100644
20--- a/glib/tests/unix.c
21+++ b/glib/tests/unix.c
22@@ -32,14 +32,15 @@ test_pipe (void)
23 GError *error = NULL;
24 int pipefd[2];
25 char buf[1024];
26- ssize_t bytes_read;
27+ ssize_t bytes_read, bytes_written;
28 gboolean res;
29
30 res = g_unix_open_pipe (pipefd, FD_CLOEXEC, &error);
31 g_assert (res);
32 g_assert_no_error (error);
33
34- write (pipefd[1], "hello", sizeof ("hello"));
35+ bytes_written = write (pipefd[1], "hello", sizeof ("hello"));
36+ g_assert (bytes_written != -1 && "write() failed");
37 memset (buf, 0, sizeof (buf));
38 bytes_read = read (pipefd[0], buf, sizeof(buf) - 1);
39 g_assert_cmpint (bytes_read, >, 0);
40--
412.8.0
42