Browse Source

staging: usbip: userspace: Check return value for mkdir()

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>
Tobias Klauser 14 years ago
parent
commit
549fb10097
1 changed files with 3 additions and 1 deletions
  1. 3 1
      drivers/staging/usbip/userspace/src/usbip_attach.c

+ 3 - 1
drivers/staging/usbip/userspace/src/usbip_attach.c

@@ -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);