commit:     530a6008938d6657e6b64f389c902f365c8f19be
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Sun Apr 14 18:39:44 2019 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Sun Apr 14 19:01:51 2019 +0000
URL:        https://gitweb.gentoo.org/proj/elfix.git/commit/?id=530a6008

install-xattr: address compiler warnings, bug #682110

Signed-off-by: Anthony G. Basile <blueness <AT> gentoo.org>

 misc/install-xattr/install-xattr.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/misc/install-xattr/install-xattr.c 
b/misc/install-xattr/install-xattr.c
index 3e20b63..5c8a978 100644
--- a/misc/install-xattr/install-xattr.c
+++ b/misc/install-xattr/install-xattr.c
@@ -239,7 +239,7 @@ main(int argc, char* argv[])
        int target_is_directory = 0;   /* is the target a directory?            
                       */
 
        int first, last;               /* argv indices of the first 
file/directory and last            */
-       char *target;                  /* the target file or directory          
                       */
+       char *target = NULL;           /* the target file or directory          
                       */
        char *path;                    /* path to the target file               
                       */
 
        char *mypath = realpath("/proc/self/exe", NULL); /* path to argv[0]     
                       */
@@ -331,7 +331,8 @@ main(int argc, char* argv[])
        char *portage_helper_path = getenv("__PORTAGE_HELPER_PATH");
        char *portage_helper_canpath = NULL;
        if (portage_helper_path)
-               chdir(oldpwd);
+               if (chdir(oldpwd) != 0)
+                       err(1, "failed to chdir %s", oldpwd);
 
        switch (fork()) {
                case -1:

Reply via email to