staging: usbip: userspace: Check return value for mkdir()
authorTobias Klauser <tklauser@distanz.ch>
Fri, 19 Aug 2011 06:54:18 +0000 (08:54 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 23 Aug 2011 21:42:33 +0000 (14:42 -0700)
mkdir() could fail, so we should check its return value.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/staging/usbip/userspace/src/usbip_attach.c

index b7885a202757282bc850772912402d77e46cca38..bdf61c0fe699c466150604e0dc868cab26992ab9 100644 (file)
@@ -51,7 +51,9 @@ static int record_connection(char *host, char *port, char *busid, int rhport)
        char buff[MAX_BUFF+1];
        int ret;
 
-       mkdir(VHCI_STATE_PATH, 0700);
+       ret = mkdir(VHCI_STATE_PATH, 0700);
+       if (ret < 0)
+               return -1;
 
        snprintf(path, PATH_MAX, VHCI_STATE_PATH"/port%d", rhport);