[Bug 6228] SMBC_open_ctx failure due to path resolve failure doesn't set errno
[samba.git] / source3 / libsmb / libsmb_dir.c
index 2255db66170fe872886d0ec9e57658fc4ef74fe2..219bbe64e120bf369174fcfe75ef6e170157de7f 100644 (file)
@@ -1171,7 +1171,8 @@ SMBC_mkdir_ctx(SMBCCTX *context,
                                srv->cli, path,
                                &targetcli, &targetpath)) {
                d_printf("Could not resolve %s\n", path);
-               TALLOC_FREE(frame);
+                errno = ENOENT;
+                TALLOC_FREE(frame);
                return -1;
        }
        /*d_printf(">>>mkdir: resolved path as %s\n", targetpath);*/
@@ -1278,6 +1279,7 @@ SMBC_rmdir_ctx(SMBCCTX *context,
                                srv->cli, path,
                                &targetcli, &targetpath)) {
                d_printf("Could not resolve %s\n", path);
+                errno = ENOENT;
                TALLOC_FREE(frame);
                return -1;
        }
@@ -1561,6 +1563,7 @@ SMBC_chmod_ctx(SMBCCTX *context,
                                srv->cli, path,
                                &targetcli, &targetpath)) {
                d_printf("Could not resolve %s\n", path);
+                errno = ENOENT;
                TALLOC_FREE(frame);
                return -1;
        }
@@ -1753,6 +1756,7 @@ SMBC_unlink_ctx(SMBCCTX *context,
                                srv->cli, path,
                                &targetcli, &targetpath)) {
                d_printf("Could not resolve %s\n", path);
+                errno = ENOENT;
                TALLOC_FREE(frame);
                return -1;
        }
@@ -1927,6 +1931,7 @@ SMBC_rename_ctx(SMBCCTX *ocontext,
                                path1,
                                &targetcli1, &targetpath1)) {
                d_printf("Could not resolve %s\n", path1);
+                errno = ENOENT;
                TALLOC_FREE(frame);
                return -1;
        }
@@ -1944,6 +1949,7 @@ SMBC_rename_ctx(SMBCCTX *ocontext,
                                path2,
                                &targetcli2, &targetpath2)) {
                d_printf("Could not resolve %s\n", path2);
+                errno = ENOENT;
                TALLOC_FREE(frame);
                return -1;
        }