All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kenneth D'souza <kdsouza@redhat.com>
To: linux-nfs@vger.kernel.org
Cc: bfields@redhat.com
Subject: [PATCH] nfs4_setfacl: Add file name to error output.
Date: Tue,  2 Jun 2020 00:57:54 +0530	[thread overview]
Message-ID: <20200601192754.5413-1-kdsouza@redhat.com> (raw)

Currently when a user tries to set acl's recursively and if
the operation fails the user is not aware on which file the error
occured. This patch adds file name to error output.

Example:
nfs4_setfacl -R -s A:dfg:6:RWX /nfsmount
Failed setxattr operation: /nfsmount/test: Operation not permitted
An error occurred during recursive file tree walk.

Signed-off-by: Kenneth D'souza <kdsouza@redhat.com>
---
 libnfs4acl/nfs4_set_acl.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libnfs4acl/nfs4_set_acl.c b/libnfs4acl/nfs4_set_acl.c
index 8a53f05..45e42fa 100644
--- a/libnfs4acl/nfs4_set_acl.c
+++ b/libnfs4acl/nfs4_set_acl.c
@@ -61,13 +61,13 @@ int nfs4_set_acl(struct nfs4_acl *acl, const char *path)
 		goto out_free;
 	} else if (res < 0) {
 		if (errno == EOPNOTSUPP)
-			fprintf(stderr,"Operation to set ACL not supported.\n");
+			fprintf(stderr,"Operation to set ACL not supported: %s\n", path);
 		else if (errno == ENODATA)
-			fprintf(stderr,"ACL Attribute not found on file.\n");
+			fprintf(stderr,"ACL Attribute not found on file: %s\n", path);
 		else if (errno == EREMOTEIO)
 			fprintf(stderr,"An NFS server error occurred.\n");
 		else
-			perror("Failed setxattr operation");
+			printf("Failed setxattr operation: %s: %s\n", path, strerror(errno));
 	}
 
 out_free:
-- 
2.21.1


             reply	other threads:[~2020-06-01 19:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-01 19:27 Kenneth D'souza [this message]
2020-06-02 20:11 ` [PATCH] nfs4_setfacl: Add file name to error output J. Bruce Fields

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200601192754.5413-1-kdsouza@redhat.com \
    --to=kdsouza@redhat.com \
    --cc=bfields@redhat.com \
    --cc=linux-nfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.