[SCM] Samba Shared Repository - branch master updated - release-4-0-0alpha7-770-g21ad907

Derrell Lipman derrell at samba.org
Fri Mar 27 22:03:38 GMT 2009


The branch, master has been updated
       via  21ad907aa01d839d405b10809517d491b72184da (commit)
       via  c33f3d5cba21c8cf267daab5450bc95ea7e68967 (commit)
      from  4b88f2c17e18f87d8ba0e35e057d7bb8a27614dd (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 21ad907aa01d839d405b10809517d491b72184da
Author: Derrell Lipman <derrell at dworkin.(none)>
Date:   Fri Mar 27 18:03:00 2009 -0400

    Ensure parameter types match format string

commit c33f3d5cba21c8cf267daab5450bc95ea7e68967
Author: Derrell Lipman <derrell at dworkin.(none)>
Date:   Fri Mar 27 18:02:46 2009 -0400

    [Bug 6228] SMBC_open_ctx failure due to path resolve failure doesn't set errno
    
    Fixed.
    
    It turns out there were a number of places where cli_resolve_path() was called
    and the error path upon that function failing did not set errno. There were a
    couple of places the failure handling code did set errno to ENOENT, so I made
    them all consistent, although I think better errno choices for this condition
    exist, e.g.  EHOSTUNREACH.
    
    Derrell

-----------------------------------------------------------------------

Summary of changes:
 examples/libsmbclient/testbrowse.c   |    2 +-
 examples/libsmbclient/testfstatvfs.c |   21 ++++++++++++++-------
 examples/libsmbclient/testsmbc.c     |   12 +++++++++---
 examples/libsmbclient/teststatvfs.c  |   21 ++++++++++++++-------
 source3/libsmb/libsmb_dir.c          |    8 +++++++-
 source3/libsmb/libsmb_file.c         |    7 +++++++
 source3/libsmb/libsmb_stat.c         |    1 +
 7 files changed, 53 insertions(+), 19 deletions(-)


Changeset truncated at 500 lines:

diff --git a/examples/libsmbclient/testbrowse.c b/examples/libsmbclient/testbrowse.c
index a6e6395..c3fb394 100644
--- a/examples/libsmbclient/testbrowse.c
+++ b/examples/libsmbclient/testbrowse.c
@@ -197,7 +197,7 @@ get_auth_data_with_context_fn(SMBCCTX * context,
                               char * pPassword,
                               int maxLenPassword)
 {
-    printf("Authenticating with context 0x%lx", context);
+    printf("Authenticating with context %p", context);
     if (context != NULL) {
         char *user_data = smbc_getOptionUserData(context);
         printf(" with user data %s", user_data);
diff --git a/examples/libsmbclient/testfstatvfs.c b/examples/libsmbclient/testfstatvfs.c
index b4dafef..73f42d4 100644
--- a/examples/libsmbclient/testfstatvfs.c
+++ b/examples/libsmbclient/testfstatvfs.c
@@ -75,13 +75,20 @@ int main(int argc, char * argv[])
             printf("\n");
             printf("Block Size: %lu\n", statvfsbuf.f_bsize);
             printf("Fragment Size: %lu\n", statvfsbuf.f_frsize);
-            printf("Blocks: %llu\n", statvfsbuf.f_blocks);
-            printf("Free Blocks: %llu\n", statvfsbuf.f_bfree);
-            printf("Available Blocks: %llu\n", statvfsbuf.f_bavail);
-            printf("Files : %llu\n", statvfsbuf.f_files);
-            printf("Free Files: %llu\n", statvfsbuf.f_ffree);
-            printf("Available Files: %llu\n", statvfsbuf.f_favail);
-            printf("File System ID: %lu\n", statvfsbuf.f_fsid);
+            printf("Blocks: %llu\n",
+                   (unsigned long long) statvfsbuf.f_blocks);
+            printf("Free Blocks: %llu\n",
+                   (unsigned long long) statvfsbuf.f_bfree);
+            printf("Available Blocks: %llu\n",
+                   (unsigned long long) statvfsbuf.f_bavail);
+            printf("Files : %llu\n",
+                   (unsigned long long) statvfsbuf.f_files);
+            printf("Free Files: %llu\n",
+                   (unsigned long long) statvfsbuf.f_ffree);
+            printf("Available Files: %llu\n",
+                   (unsigned long long) statvfsbuf.f_favail);
+            printf("File System ID: %lu\n",
+                   (unsigned long) statvfsbuf.f_fsid);
             printf("\n");
 
             printf("Flags: 0x%lx\n", statvfsbuf.f_flag);
diff --git a/examples/libsmbclient/testsmbc.c b/examples/libsmbclient/testsmbc.c
index 1f06437..de42428 100644
--- a/examples/libsmbclient/testsmbc.c
+++ b/examples/libsmbclient/testsmbc.c
@@ -21,6 +21,7 @@
 
 #include <stdio.h>
 #include <errno.h>
+#include <time.h>
 #include <sys/time.h>
 #include <string.h>
 #include <unistd.h>
@@ -33,8 +34,12 @@ int global_id = 0;
 void print_list_fn(struct print_job_info *pji)
 {
 
-  fprintf(stdout, "Print job: ID: %u, Prio: %u, Size: %u, User: %s, Name: %s\n",
-	  pji->id, pji->priority, pji->size, pji->user, pji->name);
+  fprintf(stdout, "Print job: ID: %u, Prio: %u, Size: %lu, User: %s, Name: %s\n",
+	  pji->id,
+          pji->priority,
+          (unsigned long) pji->size,
+          pji->user,
+          pji->name);
 
   global_id = pji->id;
 
@@ -137,7 +142,8 @@ int main(int argc, char *argv[])
 
   }
 
-  fprintf(stdout, "Wrote %d bytes to file: %s\n", sizeof(buff), buff);
+  fprintf(stdout, "Wrote %lu bytes to file: %s\n",
+          (unsigned long) sizeof(buff), buff);
 
   /* Now, seek the file back to offset 0 */
 
diff --git a/examples/libsmbclient/teststatvfs.c b/examples/libsmbclient/teststatvfs.c
index 8812002..b7e6b51 100644
--- a/examples/libsmbclient/teststatvfs.c
+++ b/examples/libsmbclient/teststatvfs.c
@@ -49,13 +49,20 @@ int main(int argc, char * argv[])
             printf("\n");
             printf("Block Size: %lu\n", statvfsbuf.f_bsize);
             printf("Fragment Size: %lu\n", statvfsbuf.f_frsize);
-            printf("Blocks: %llu\n", statvfsbuf.f_blocks);
-            printf("Free Blocks: %llu\n", statvfsbuf.f_bfree);
-            printf("Available Blocks: %llu\n", statvfsbuf.f_bavail);
-            printf("Files : %llu\n", statvfsbuf.f_files);
-            printf("Free Files: %llu\n", statvfsbuf.f_ffree);
-            printf("Available Files: %llu\n", statvfsbuf.f_favail);
-            printf("File System ID: %lu\n", statvfsbuf.f_fsid);
+            printf("Blocks: %llu\n",
+                   (unsigned long long) statvfsbuf.f_blocks);
+            printf("Free Blocks: %llu\n",
+                   (unsigned long long) statvfsbuf.f_bfree);
+            printf("Available Blocks: %llu\n",
+                   (unsigned long long) statvfsbuf.f_bavail);
+            printf("Files : %llu\n",
+                   (unsigned long long) statvfsbuf.f_files);
+            printf("Free Files: %llu\n",
+                   (unsigned long long) statvfsbuf.f_ffree);
+            printf("Available Files: %llu\n",
+                   (unsigned long long) statvfsbuf.f_favail);
+            printf("File System ID: %lu\n",
+                   (unsigned long) statvfsbuf.f_fsid);
             printf("\n");
 
             printf("Flags: 0x%lx\n", statvfsbuf.f_flag);
diff --git a/source3/libsmb/libsmb_dir.c b/source3/libsmb/libsmb_dir.c
index 2255db6..219bbe6 100644
--- a/source3/libsmb/libsmb_dir.c
+++ b/source3/libsmb/libsmb_dir.c
@@ -1171,7 +1171,8 @@ SMBC_mkdir_ctx(SMBCCTX *context,
 				srv->cli, path,
 				&targetcli, &targetpath)) {
 		d_printf("Could not resolve %s\n", path);
-		TALLOC_FREE(frame);
+                errno = ENOENT;
+                TALLOC_FREE(frame);
 		return -1;
 	}
 	/*d_printf(">>>mkdir: resolved path as %s\n", targetpath);*/
@@ -1278,6 +1279,7 @@ SMBC_rmdir_ctx(SMBCCTX *context,
 				srv->cli, path,
 				&targetcli, &targetpath)) {
 		d_printf("Could not resolve %s\n", path);
+                errno = ENOENT;
 		TALLOC_FREE(frame);
 		return -1;
 	}
@@ -1561,6 +1563,7 @@ SMBC_chmod_ctx(SMBCCTX *context,
 				srv->cli, path,
 				&targetcli, &targetpath)) {
 		d_printf("Could not resolve %s\n", path);
+                errno = ENOENT;
 		TALLOC_FREE(frame);
 		return -1;
 	}
@@ -1753,6 +1756,7 @@ SMBC_unlink_ctx(SMBCCTX *context,
 				srv->cli, path,
 				&targetcli, &targetpath)) {
 		d_printf("Could not resolve %s\n", path);
+                errno = ENOENT;
 		TALLOC_FREE(frame);
 		return -1;
 	}
@@ -1927,6 +1931,7 @@ SMBC_rename_ctx(SMBCCTX *ocontext,
 				path1,
 				&targetcli1, &targetpath1)) {
 		d_printf("Could not resolve %s\n", path1);
+                errno = ENOENT;
 		TALLOC_FREE(frame);
 		return -1;
 	}
@@ -1944,6 +1949,7 @@ SMBC_rename_ctx(SMBCCTX *ocontext,
 				path2,
 				&targetcli2, &targetpath2)) {
 		d_printf("Could not resolve %s\n", path2);
+                errno = ENOENT;
 		TALLOC_FREE(frame);
 		return -1;
 	}
diff --git a/source3/libsmb/libsmb_file.c b/source3/libsmb/libsmb_file.c
index 06e41ad..aa02807 100644
--- a/source3/libsmb/libsmb_file.c
+++ b/source3/libsmb/libsmb_file.c
@@ -119,6 +119,7 @@ SMBC_open_ctx(SMBCCTX *context,
 				srv->cli, path,
 				&targetcli, &targetpath)) {
 			d_printf("Could not resolve %s\n", path);
+                        errno = ENOENT;
 			SAFE_FREE(file);
 			TALLOC_FREE(frame);
 			return NULL;
@@ -300,6 +301,7 @@ SMBC_read_ctx(SMBCCTX *context,
 			file->srv->cli, path,
 			&targetcli, &targetpath)) {
 		d_printf("Could not resolve %s\n", path);
+                errno = ENOENT;
 		TALLOC_FREE(frame);
 		return -1;
 	}
@@ -390,6 +392,7 @@ SMBC_write_ctx(SMBCCTX *context,
 			file->srv->cli, path,
 			&targetcli, &targetpath)) {
 		d_printf("Could not resolve %s\n", path);
+                errno = ENOENT;
 		TALLOC_FREE(frame);
 		return -1;
 	}
@@ -466,6 +469,7 @@ SMBC_close_ctx(SMBCCTX *context,
 			file->srv->cli, path,
 			&targetcli, &targetpath)) {
 		d_printf("Could not resolve %s\n", path);
+                errno = ENOENT;
 		TALLOC_FREE(frame);
 		return -1;
 	}
@@ -549,6 +553,7 @@ SMBC_getatr(SMBCCTX * context,
 			srv->cli, fixedpath,
 			&targetcli, &targetpath)) {
 		d_printf("Couldn't resolve %s\n", path);
+                errno = ENOENT;
 		TALLOC_FREE(frame);
 		return False;
 	}
@@ -762,6 +767,7 @@ SMBC_lseek_ctx(SMBCCTX *context,
 				file->srv->cli, path,
 				&targetcli, &targetpath)) {
 			d_printf("Could not resolve %s\n", path);
+                        errno = ENOENT;
 			TALLOC_FREE(frame);
 			return -1;
 		}
@@ -854,6 +860,7 @@ SMBC_ftruncate_ctx(SMBCCTX *context,
 			file->srv->cli, path,
 			&targetcli, &targetpath)) {
 		d_printf("Could not resolve %s\n", path);
+                errno = ENOENT;
 		TALLOC_FREE(frame);
 		return -1;
 	}
diff --git a/source3/libsmb/libsmb_stat.c b/source3/libsmb/libsmb_stat.c
index dc904d2..c2806da 100644
--- a/source3/libsmb/libsmb_stat.c
+++ b/source3/libsmb/libsmb_stat.c
@@ -261,6 +261,7 @@ SMBC_fstat_ctx(SMBCCTX *context,
 			file->srv->cli, path,
 			&targetcli, &targetpath)) {
 		d_printf("Could not resolve %s\n", path);
+                errno = ENOENT;
 		TALLOC_FREE(frame);
 		return -1;
 	}


-- 
Samba Shared Repository


More information about the samba-cvs mailing list