diff mbox series

getcifsacl: Do not go to parse_sec_desc if getxattr fails.

Message ID 20190219014343.29526-1-kdsouza@redhat.com (mailing list archive)
State New, archived
Headers show
Series getcifsacl: Do not go to parse_sec_desc if getxattr fails. | expand

Commit Message

Kenneth Dsouza Feb. 19, 2019, 1:43 a.m. UTC
Add more to the error message by printing the filename and error.

Signed-off-by: Kenneth D'souza <kdsouza@redhat.com>
---
 getcifsacl.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Comments

Steve French Feb. 19, 2019, 4:40 a.m. UTC | #1
Reviewed-by: Steve French <stfrench@microsoft.com>

On Mon, Feb 18, 2019 at 7:43 PM Kenneth D'souza <kdsouza@redhat.com> wrote:
>
> Add more to the error message by printing the filename and error.
>
> Signed-off-by: Kenneth D'souza <kdsouza@redhat.com>
> ---
>  getcifsacl.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/getcifsacl.c b/getcifsacl.c
> index f08cdea..7f6e673 100644
> --- a/getcifsacl.c
> +++ b/getcifsacl.c
> @@ -399,7 +399,12 @@ cifsacl:
>                         bufsize += BUFSIZE;
>                         goto cifsacl;
>                 } else
> -                       printf("getxattr error: %d\n", errno);
> +               {
> +                       fprintf(stderr, "getxattr failed on %s: %s\n", filename, strerror(errno) );
> +                       free(attrval);
> +                       ret = -1;
> +                       goto out;
> +               }
>         }
>
>         parse_sec_desc((struct cifs_ntsd *)attrval, attrlen, raw);
> --
> 2.20.1
>
Pavel Shilovsky March 9, 2019, 12:37 a.m. UTC | #2
пн, 18 февр. 2019 г. в 20:40, Steve French <smfrench@gmail.com>:
>
> Reviewed-by: Steve French <stfrench@microsoft.com>
>
> On Mon, Feb 18, 2019 at 7:43 PM Kenneth D'souza <kdsouza@redhat.com> wrote:
> >
> > Add more to the error message by printing the filename and error.
> >
> > Signed-off-by: Kenneth D'souza <kdsouza@redhat.com>
> > ---
> >  getcifsacl.c | 7 ++++++-
> >  1 file changed, 6 insertions(+), 1 deletion(-)
> >
> > diff --git a/getcifsacl.c b/getcifsacl.c
> > index f08cdea..7f6e673 100644
> > --- a/getcifsacl.c
> > +++ b/getcifsacl.c
> > @@ -399,7 +399,12 @@ cifsacl:
> >                         bufsize += BUFSIZE;
> >                         goto cifsacl;
> >                 } else
> > -                       printf("getxattr error: %d\n", errno);
> > +               {
> > +                       fprintf(stderr, "getxattr failed on %s: %s\n", filename, strerror(errno) );
> > +                       free(attrval);
> > +                       ret = -1;
> > +                       goto out;
> > +               }
> >         }
> >
> >         parse_sec_desc((struct cifs_ntsd *)attrval, attrlen, raw);
> > --
> > 2.20.1
> >
merged, thanks.
--
Best regards,
Pavel Shilovsky
diff mbox series

Patch

diff --git a/getcifsacl.c b/getcifsacl.c
index f08cdea..7f6e673 100644
--- a/getcifsacl.c
+++ b/getcifsacl.c
@@ -399,7 +399,12 @@  cifsacl:
 			bufsize += BUFSIZE;
 			goto cifsacl;
 		} else
-			printf("getxattr error: %d\n", errno);
+		{
+			fprintf(stderr, "getxattr failed on %s: %s\n", filename, strerror(errno) );
+			free(attrval);
+			ret = -1;
+			goto out;
+		}
 	}
 
 	parse_sec_desc((struct cifs_ntsd *)attrval, attrlen, raw);