Diff between b77a1769c269cbd405faa831cf8db4bf7ea39668 and e265df74043faeaac9747583e785c257053f0c91

Changed Files

File Additions Deletions Status
obexd/plugins/ftp.c +9 -5 modified

Full Patch

diff --git a/obexd/plugins/ftp.c b/obexd/plugins/ftp.c
index 7b70ed0..e9cb96a 100644
--- a/obexd/plugins/ftp.c
+++ b/obexd/plugins/ftp.c
@@ -370,12 +370,14 @@ static int ftp_setpath(struct obex_session *os, obex_object_t *obj,
 		err = lstat(fullname, &dstat);
 
 	if (err < 0) {
-		int err = errno;
-		debug("%s: %s(%d)", root ? "stat" : "lstat",
-				strerror(err), err);
-		if (err == ENOENT)
+		err = -errno;
+
+		if (err == -ENOENT)
 			goto not_found;
 
+		debug("%s: %s(%d)", root ? "stat" : "lstat",
+				strerror(-err), -err);
+
 		goto done;
 	}
 
@@ -395,10 +397,12 @@ not_found:
 	}
 
 	if (mkdir(fullname, 0755) <  0) {
-		err = -EPERM;
+		err = -errno;
+		debug("mkdir: %s(%d)", strerror(-err), -err);
 		goto done;
 	}
 
+	err = 0;
 	set_folder(ftp, fullname);
 
 done: