]> arthur.barton.de Git - bup.git/blobdiff - lib/bup/_helpers.c
Assume FS_IOC_GETFLAGS may trash output on error
[bup.git] / lib / bup / _helpers.c
index 65a8b6bafa8ef51efeab07c5d8cf7febb7b0787e..9082dca72994079da1f900f8785f751a3d52715c 100644 (file)
@@ -842,14 +842,13 @@ static PyObject *bup_get_linux_file_attr(PyObject *self, PyObject *args)
 
     attr = 0;  // Handle int/long mismatch (see above)
     rc = ioctl(fd, FS_IOC_GETFLAGS, &attr);
-    assert(attr <= UINT_MAX);  // Kernel type is actually int
     if (rc == -1)
     {
         close(fd);
         return PyErr_SetFromErrnoWithFilename(PyExc_OSError, path);
     }
-
     close(fd);
+    assert(attr <= UINT_MAX);  // Kernel type is actually int
     return PyLong_FromUnsignedLong(attr);
 }
 #endif /* def BUP_HAVE_FILE_ATTRS */