From 13532afba1d8dfd77038b2607e3a68a15a23970c Mon Sep 17 00:00:00 2001 From: Pablo Barciela Date: Fri, 12 Jan 2018 16:29:56 +0100 Subject: =?UTF-8?q?theme-thumbnail.c:=20Fix=20build=20warnings=20with=20?= =?UTF-8?q?=E2=80=98write=E2=80=99=20and=20=E2=80=98pipe=E2=80=99:?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ignoring return value declared with attribute warn_unused_result --- capplets/common/theme-thumbnail.c | 72 ++++++++++++++++++++++++++++++--------- 1 file changed, 55 insertions(+), 17 deletions(-) (limited to 'capplets') diff --git a/capplets/common/theme-thumbnail.c b/capplets/common/theme-thumbnail.c index 4fb96402..a3111374 100644 --- a/capplets/common/theme-thumbnail.c +++ b/capplets/common/theme-thumbnail.c @@ -593,12 +593,17 @@ message_from_capplet (GIOChannel *source, } /* Write the pixbuf's size */ - write (pipe_from_factory_fd[1], &width, sizeof (width)); - write (pipe_from_factory_fd[1], &height, sizeof (height)); + + if (write (pipe_from_factory_fd[1], &width, sizeof (width)) == -1) + perror ("write error"); + + if (write (pipe_from_factory_fd[1], &height, sizeof (height)) == -1) + perror ("write error"); for (i = 0; i < height; i++) { - write (pipe_from_factory_fd[1], pixels + rowstride * i, width * gdk_pixbuf_get_n_channels (pixbuf)); + if (write (pipe_from_factory_fd[1], pixels + rowstride * i, width * gdk_pixbuf_get_n_channels (pixbuf)) == -1) + perror ("write error"); } if (pixbuf) @@ -761,33 +766,63 @@ send_thumbnail_request (gchar *thumbnail_type, gchar *icon_theme_name, gchar *application_font) { - write (pipe_to_factory_fd[1], thumbnail_type, strlen (thumbnail_type) + 1); + if (write (pipe_to_factory_fd[1], thumbnail_type, strlen (thumbnail_type) + 1) == -1) + perror ("write error"); if (gtk_theme_name) - write (pipe_to_factory_fd[1], gtk_theme_name, strlen (gtk_theme_name) + 1); + { + if (write (pipe_to_factory_fd[1], gtk_theme_name, strlen (gtk_theme_name) + 1) == -1) + perror ("write error"); + } else - write (pipe_to_factory_fd[1], "", 1); + { + if (write (pipe_to_factory_fd[1], "", 1) == -1) + perror ("write error"); + } if (gtk_color_scheme) - write (pipe_to_factory_fd[1], gtk_color_scheme, strlen (gtk_color_scheme) + 1); + { + if (write (pipe_to_factory_fd[1], gtk_color_scheme, strlen (gtk_color_scheme) + 1) == -1) + perror ("write error"); + } else - write (pipe_to_factory_fd[1], "", 1); + { + if (write (pipe_to_factory_fd[1], "", 1) == -1) + perror ("write error"); + } if (marco_theme_name) - write (pipe_to_factory_fd[1], marco_theme_name, strlen (marco_theme_name) + 1); + { + if (write (pipe_to_factory_fd[1], marco_theme_name, strlen (marco_theme_name) + 1) == -1) + perror ("write error"); + } else - write (pipe_to_factory_fd[1], "", 1); + { + if (write (pipe_to_factory_fd[1], "", 1) == -1) + perror ("write error"); + } if (icon_theme_name) - write (pipe_to_factory_fd[1], icon_theme_name, strlen (icon_theme_name) + 1); + { + if (write (pipe_to_factory_fd[1], icon_theme_name, strlen (icon_theme_name) + 1) == -1) + perror ("write error"); + } else - write (pipe_to_factory_fd[1], "", 1); + { + if (write (pipe_to_factory_fd[1], "", 1) == -1) + perror ("write error"); + } if (application_font) - write (pipe_to_factory_fd[1], application_font, strlen (application_font) + 1); + { + if (write (pipe_to_factory_fd[1], application_font, strlen (application_font) + 1) == -1) + perror ("write error"); + } else - write (pipe_to_factory_fd[1], "Sans 10", strlen ("Sans 10") + 1); - + { + if (write (pipe_to_factory_fd[1], "Sans 10", strlen ("Sans 10") + 1) == -1) + perror ("write error"); + } } static GdkPixbuf * @@ -1032,8 +1067,11 @@ theme_thumbnail_factory_init (int argc, char *argv[]) gint child_pid; #endif - pipe (pipe_to_factory_fd); - pipe (pipe_from_factory_fd); + if (pipe (pipe_to_factory_fd) == -1) + perror ("pipe error"); + + if (pipe (pipe_from_factory_fd) == -1) + perror ("pipe error"); /* Apple's CoreFoundation classes must not be used from forked * processes. Since freetype (and thus GTK) uses them, we simply -- cgit v1.2.1