s3-vfs: Set errno in xattr emulation
authorAndrew Bartlett <abartlet@samba.org>
Wed, 15 Aug 2012 12:22:26 +0000 (22:22 +1000)
committerAndrew Bartlett <abartlet@samba.org>
Wed, 15 Aug 2012 16:05:33 +0000 (18:05 +0200)
The caller may check this errno.

Andrew Bartlett

Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Wed Aug 15 18:05:33 CEST 2012 on sn-devel-104

source3/modules/vfs_posix_eadb.c
source3/modules/vfs_xattr_tdb.c

index c8bebc4c0f1b0c7b0d99a183ea13c2f916b38f2c..fff7c11dce93be92402d954f78337636398173e1 100644 (file)
@@ -52,6 +52,11 @@ static ssize_t posix_eadb_getattr(struct tdb_wrap *db_ctx,
 
        status = pull_xattr_blob_tdb_raw(db_ctx, talloc_tos(), name, fname, fd, size, &blob);
 
+       if (NT_STATUS_EQUAL(status, NT_STATUS_NOT_FOUND)) {
+               errno = ENOATTR;
+               return -1;
+       }
+
        if (!NT_STATUS_IS_OK(status)) {
                DEBUG(10, ("posix_eadb_fetch_attrs failed: %s\n",
                           nt_errstr(status)));
index 80db90441d3fd8cd1284dbadd19a07b86c6c4570..719ac0c84df44531ba12c41a946fbad3a4f475a1 100644 (file)
@@ -50,6 +50,7 @@ static ssize_t xattr_tdb_getxattr(struct vfs_handle_struct *handle,
 
        xattr_size = xattr_tdb_getattr(db, frame, &id, name, &blob);
        if (xattr_size < 0) {
+               errno = ENOATTR;
                TALLOC_FREE(frame);
                return -1;
        }
@@ -85,6 +86,7 @@ static ssize_t xattr_tdb_fgetxattr(struct vfs_handle_struct *handle,
 
        xattr_size = xattr_tdb_getattr(db, frame, &id, name, &blob);
        if (xattr_size < 0) {
+               errno = ENOATTR;
                TALLOC_FREE(frame);
                return -1;
        }