Minor change on how error handling style in ACL_init
authorIustin Pop <iustin@k1024.org>
Sat, 30 Nov 2019 15:58:31 +0000 (16:58 +0100)
committerIustin Pop <iustin@k1024.org>
Sat, 30 Nov 2019 15:58:31 +0000 (16:58 +0100)
acl.c

diff --git a/acl.c b/acl.c
index 7d7f4b24f7ab5ac6dc8db60529f23b099a67d8a1..a12a9c5fae03162facc43167bb7a3719ebb61000 100644 (file)
--- a/acl.c
+++ b/acl.c
@@ -165,6 +165,8 @@ static int ACL_init(PyObject* obj, PyObject* args, PyObject *keywds) {
     if(self->acl != NULL)
         acl_free(self->acl);
 
+    self->acl = NULL;
+
     if(file != NULL) {
         fprintf(stderr, "foobar!\n");
         char *path = PyBytes_AS_STRING(file);
@@ -176,11 +178,8 @@ static int ACL_init(PyObject* obj, PyObject* args, PyObject *keywds) {
         int fdval;
         if ((fdval = PyObject_AsFileDescriptor(fd)) != -1) {
             self->acl = acl_get_fd(fdval);
-        } else {
-            self->acl = NULL;
         }
-    }
-    else if(thesrc != NULL)
+    } else if(thesrc != NULL)
         self->acl = acl_dup(thesrc->acl);
     else if(filedef != NULL) {
         char *path = PyBytes_AS_STRING(filedef);