winpr: _IoCreateDeviceEx: fix mkdir error check
authorMike Gilbert <floppym@gentoo.org>
Mon, 30 Oct 2017 00:26:53 +0000 (20:26 -0400)
committerMike Gilbert <floppym@gentoo.org>
Mon, 30 Oct 2017 15:59:35 +0000 (11:59 -0400)
The mkdir(2) function returns 0 on success, and -1 on error.

This resolves an error in TestIoDevice when /tmp/.device/ does not
exist.

Bug: https://bugs.gentoo.org/635838

winpr/libwinpr/io/device.c

index 0e13092..2a1b7f8 100644 (file)
@@ -138,7 +138,7 @@ NTSTATUS _IoCreateDeviceEx(PDRIVER_OBJECT_EX DriverObject, ULONG DeviceExtension
 
        if (!PathFileExistsA(DeviceBasePath))
        {
-               if (!mkdir(DeviceBasePath, S_IRUSR | S_IWUSR | S_IXUSR))
+               if (mkdir(DeviceBasePath, S_IRUSR | S_IWUSR | S_IXUSR) != 0)
                {
                        free(DeviceBasePath);
                        return STATUS_ACCESS_DENIED;