Bug 5661 - mount.cifs: unclear error message with "credentials"
mount.cifs: unclear error message with "credentials"
Status: RESOLVED FIXED
Product: CifsVFS
Classification: Unclassified
Component: user space tools
2.6
x64 Linux
: P3 minor
: ---
Assigned To: Steve French
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2008-08-02 05:52 UTC by Christophe
Modified: 2008-08-26 15:29 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Christophe 2008-08-02 05:52:14 UTC
When there is a problem through the "credentials" file processing, the error message provides only a number. This is not really helpful...

I would propose this simple (but helpful) patch:

--- mount.cifs.orig     2008-08-02 10:25:40.000000000 +0000
+++ mount.cifs.c        2008-08-02 10:41:11.000000000 +0000
@@ -128,7 +128,7 @@
                return errno;
        line_buf = malloc(4096);
        if(line_buf == NULL)
-               return -ENOMEM;
+               return ENOMEM;
 
        while(fgets(line_buf,4096,fs)) {
                /* parse line from credential file */
@@ -420,7 +420,8 @@
                        if (value && *value) {
                                rc = open_cred_file(value);
                                if(rc) {
-                                       printf("error %d opening credential file %s\n",rc, value);
+                                       printf("error %d opening credential file %s (%s)\n",
+                                              rc, value, strerror(rc));
                                        return 1;
                                }
                        } else {
Comment 1 Steve French 2008-08-26 12:34:50 UTC
checked in the following:
diff --git a/source/client/mount.cifs.c b/source/client/mount.cifs.c
index dd878aa..9d2b449 100644
--- a/source/client/mount.cifs.c
+++ b/source/client/mount.cifs.c
@@ -196,7 +196,7 @@ static int open_cred_file(char * file_name)
        line_buf = (char *)malloc(4096);
        if(line_buf == NULL) {
                fclose(fs);
-               return -ENOMEM;
+               return ENOMEM;
        }
 
        while(fgets(line_buf,4096,fs)) {
@@ -537,7 +537,8 @@ static int parse_options(char ** optionsp, int * filesys_flags)
                        if (value && *value) {
                                rc = open_cred_file(value);
                                if(rc) {
-                                       printf("error %d opening credential file %s\n",rc, value);
+                                       printf("error %d (%s) opening credential file %s\n",
+                                               rc, strerror(rc), value);
                                        return 1;
                                }
                        } else {
Comment 2 Steve French 2008-08-26 15:29:54 UTC
merged into 3-2-test and 3-3-test versions of Samba