[PATCH] staging: usbip: userspace: Check return value for mkdir()

Tobias Klauser tklauser at distanz.ch
Fri Aug 19 06:54:18 UTC 2011


mkdir() could fail, so we should check its return value.

Signed-off-by: Tobias Klauser <tklauser at distanz.ch>
---
 drivers/staging/usbip/userspace/src/usbip_attach.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/staging/usbip/userspace/src/usbip_attach.c b/drivers/staging/usbip/userspace/src/usbip_attach.c
index b7885a2..bdf61c0 100644
--- a/drivers/staging/usbip/userspace/src/usbip_attach.c
+++ b/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);
 
-- 
1.7.5.4




More information about the devel mailing list