diff mbox

Use errno instead of having unknown error

Message ID 1342690708-15087-1-git-send-email-luk@debian.org (mailing list archive)
State New, archived
Headers show

Commit Message

Luk Claes July 19, 2012, 9:38 a.m. UTC
When access() fails, use errno for a sensible error message.

Signed-off-by: Luk Claes <luk@debian.org>
---
 mount.cifs.c |    1 +
 1 file changed, 1 insertion(+)

Comments

Jeff Layton July 19, 2012, 11:13 a.m. UTC | #1
On Thu, 19 Jul 2012 11:38:28 +0200
Luk Claes <luk@debian.org> wrote:

> When access() fails, use errno for a sensible error message.
> 
> Signed-off-by: Luk Claes <luk@debian.org>
> ---
>  mount.cifs.c |    1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/mount.cifs.c b/mount.cifs.c
> index 6f3f382..f47f416 100644
> --- a/mount.cifs.c
> +++ b/mount.cifs.c
> @@ -590,6 +590,7 @@ static int open_cred_file(char *file_name,
>  	i = access(file_name, R_OK);
>  	if (i) {
>  		toggle_dac_capability(0, 0);
> +		i = errno;
>  		goto return_i;
>  	}
>  

Looks correct.

Thanks!
Jeff Layton July 20, 2012, 6:50 p.m. UTC | #2
On Thu, 19 Jul 2012 11:38:28 +0200
Luk Claes <luk@debian.org> wrote:

> When access() fails, use errno for a sensible error message.
> 
> Signed-off-by: Luk Claes <luk@debian.org>
> ---
>  mount.cifs.c |    1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/mount.cifs.c b/mount.cifs.c
> index 6f3f382..f47f416 100644
> --- a/mount.cifs.c
> +++ b/mount.cifs.c
> @@ -590,6 +590,7 @@ static int open_cred_file(char *file_name,
>  	i = access(file_name, R_OK);
>  	if (i) {
>  		toggle_dac_capability(0, 0);
> +		i = errno;
>  		goto return_i;
>  	}
>  

Merged...
diff mbox

Patch

diff --git a/mount.cifs.c b/mount.cifs.c
index 6f3f382..f47f416 100644
--- a/mount.cifs.c
+++ b/mount.cifs.c
@@ -590,6 +590,7 @@  static int open_cred_file(char *file_name,
 	i = access(file_name, R_OK);
 	if (i) {
 		toggle_dac_capability(0, 0);
+		i = errno;
 		goto return_i;
 	}