[gnome-shell] test-theme: Check return value of chdir()



commit 6f881f232e17c0570a72437e71d4648dccfdf3e2
Author: Will Thompson <wjt endlessm com>
Date:   Tue Apr 21 13:44:57 2020 +0100

    test-theme: Check return value of chdir()
    
    I noticed the following warning while building the .deb package for
    gnome-shell on Endless OS:
    
          ../src/st/test-theme.c: In function ‘main’:
          ../src/st/test-theme.c:549:3: warning: ignoring return value of ‘chdir’, declared with attribute 
warn_unused_result [-Wunused-result]
             chdir (cwd);
             ^~~~~~~~~~~
    
    (Of course this is very unlikely to fail in practice.)
    
    https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1208

 src/st/test-theme.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
---
diff --git a/src/st/test-theme.c b/src/st/test-theme.c
index bd422da006..048dcad45a 100644
--- a/src/st/test-theme.c
+++ b/src/st/test-theme.c
@@ -546,7 +546,8 @@ main (int argc, char **argv)
 
   meta_test_init ();
 
-  chdir (cwd);
+  if (chdir (cwd) < 0)
+    g_error ("chdir('%s') failed: %s", cwd, g_strerror (errno));
 
   /* Make sure our assumptions about resolution are correct */
   g_object_set (clutter_settings_get_default (), "font-dpi", -1, NULL);


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