[SCM] Samba Shared Repository - branch master updated

Michael Adam obnox at samba.org
Fri May 13 01:51:03 UTC 2016


The branch, master has been updated
       via  8b3ae1b s4:repl_meta_data: squelch compile warning with -O3
       via  3b4eb71 s3:modules/vfs_snapper squelch -O3 compile warning
       via  fb81a0b examples:smbclient:write: fix O3 error unused result of fgets
       via  b279aa1 examples:smbclient:read: fix O3 error unused result of fgets
       via  398bb12 examples:smbclient:fstatvfs: fix O3 error unused result of fgets
       via  49b9185 examples:smbclient:statvfs: fix O3 error unused result of fgets
       via  2ec0ecc examples:smbclient:notify: fix O3 error unused result from fgets
       via  5dae286 examples:smbclient:testacl3: fix O3 error unused result from fgets
       via  ac64aab s3:vfs:preopen: fix O3 error unused result of write
       via  1f04687 s3:vfs:aio_fork: fix O3 error unused result of write
       via  3776a9c s3:smbfilter: fix O3 error unused result of system()
       via  6bd436f s3:utils:log2pcaphex: fix O3 error uninitialized variable
       via  b7cf771 s3:utils:log2pcaphex: fix O3 error unused result of fgets
       via  8f16d23 s3:samlogon_cache: fix O3 error unused result of truncate
       via  33d20f9 s4:client: fix O3 error unused result of of chdir and system
       via  a7fc5e0 s4:torture:nbench: fix O3 error unused result of asprintf
       via  ea668a2 s4:torture:rpc:samlogon: fix O3 error unused result of asprintf
       via  080946c s4:torture:basic:delete: fix O3 error unused result of asprintf
       via  ef63ebd s4:torture:basic:dir: fix O3 error unused result of asprintf
       via  f725691 s4:torture:basic: fix O3 error unused result of write
       via  9918234 s4:torture:basic:misc: fix O3 error unused result of asprintf
       via  ebfbf6b s4:torture:basic: fix O3 error unused result of asprintf
       via  a6db052 s4:regshell: fix O3 error unused result of asprintf in reg_complete_key()
       via  2a2d990 s4:ntvfs: fix O3 error unused result of write error in nbench_log()
       via  93b1dac s4:ntvfs: fix O3 error unused result of asprintf in cifspsx_file_utime()
       via  fa80f1a s4:ntvfs: fix O3 error unused result of asprintf in cifspsx_list_unix
       via  8f4759d s4:ntvfs: fix O3 error unused result of asprintf in cifspsx_map_fileinfo
       via  b64a24e s4:ntvfs: fix O3 error unused result of asprintf in svfs_file_utime
       via  8e52137 s4:ntvfs: fix O3 error unused result of asprintf
       via  2d8a312 s4:registry:patchfile: fix O3 error unused result of write
       via  c150234 s4:libcli:resolve: fix O3 error unused result of write
       via  258360f lib: add sys_write_v - void variant of sys_write
       via  4680fe0 lib: add sys_read_v - void variant of sys_read
       via  af83bc3 debug: fix -O3 warning - unused return code of write()
       via  0e80775 tdb:torture: fix -O3 error unused result of write
       via  a860245 tdb:torture: fix -O3 error unused result code of read
       via  7740876 tevent:testsuite: fix O3 errors unused result of write
       via  22918a0 tevent:testsuite: fix O3 errors unused result for read
       via  1521e68 tevent:signal: fix -O3 error unused result of read
       via  24b267e tevent:signal: fix -O3 error unused result of write
       via  149fa72 tevent:threads: fix -O3 error unused result of write
      from  a55ac51 s3:rpcclient add -m option

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


- Log -----------------------------------------------------------------
commit 8b3ae1bb9ce13bb7dd4d024cb4a5a07757986633
Author: Christian Ambach <ambi at samba.org>
Date:   Thu May 12 17:10:51 2016 +0200

    s4:repl_meta_data: squelch compile warning with -O3
    
    Signed-off-by: Christian Ambach <ambi at samba.org>
    Reviewed-by: Michael Adam <obnox at samba.org>
    
    Autobuild-User(master): Michael Adam <obnox at samba.org>
    Autobuild-Date(master): Fri May 13 03:50:10 CEST 2016 on sn-devel-144

commit 3b4eb715c5eab8dc91ee9709c0f56af7570d8b70
Author: Christian Ambach <ambi at samba.org>
Date:   Sat Apr 2 02:08:05 2016 +0200

    s3:modules/vfs_snapper squelch -O3 compile warning
    
    Signed-off-by: Christian Ambach <ambi at samba.org>
    Reviewed-by: Michael Adam <obnox at samba.org>

commit fb81a0b4e21086dc87f8ce1999266a0e7a5b0763
Author: Michael Adam <obnox at samba.org>
Date:   Tue Apr 5 23:07:11 2016 +0200

    examples:smbclient:write: fix O3 error unused result of fgets
    
    Signed-off-by: Michael Adam <obnox at samba.org>
    Reviewed-by: Christian Ambach <ambi at samba.org>

commit b279aa1f7cab0dcdf8466f0bea13faa0cbabacba
Author: Michael Adam <obnox at samba.org>
Date:   Tue Apr 5 22:57:51 2016 +0200

    examples:smbclient:read: fix O3 error unused result of fgets
    
    Signed-off-by: Michael Adam <obnox at samba.org>
    Reviewed-by: Christian Ambach <ambi at samba.org>

commit 398bb129f5095e22cf45fdcf84b1025268c64c53
Author: Michael Adam <obnox at samba.org>
Date:   Tue Apr 5 22:55:01 2016 +0200

    examples:smbclient:fstatvfs: fix O3 error unused result of fgets
    
    Signed-off-by: Michael Adam <obnox at samba.org>
    Reviewed-by: Christian Ambach <ambi at samba.org>

commit 49b91853c38298858cea09c0d663cd6ffab1899c
Author: Michael Adam <obnox at samba.org>
Date:   Tue Apr 5 22:50:52 2016 +0200

    examples:smbclient:statvfs: fix O3 error unused result of fgets
    
    Signed-off-by: Michael Adam <obnox at samba.org>
    Reviewed-by: Christian Ambach <ambi at samba.org>

commit 2ec0ecc7a5022ff8fce9ce562cd3b41517477fcc
Author: Michael Adam <obnox at samba.org>
Date:   Tue Apr 5 22:36:34 2016 +0200

    examples:smbclient:notify: fix O3 error unused result from fgets
    
    Signed-off-by: Michael Adam <obnox at samba.org>
    Reviewed-by: Christian Ambach <ambi at samba.org>

commit 5dae28632b05a80365ea8ebb9968c4eb2ee2b98a
Author: Michael Adam <obnox at samba.org>
Date:   Tue Apr 5 22:34:32 2016 +0200

    examples:smbclient:testacl3: fix O3 error unused result from fgets
    
    Signed-off-by: Michael Adam <obnox at samba.org>
    Reviewed-by: Christian Ambach <ambi at samba.org>

commit ac64aab40ec09f4dd6c3cc629bcf8f213b55d014
Author: Michael Adam <obnox at samba.org>
Date:   Tue Apr 5 22:22:47 2016 +0200

    s3:vfs:preopen: fix O3 error unused result of write
    
    (void) cast is not enough.
    
    Signed-off-by: Michael Adam <obnox at samba.org>
    Reviewed-by: Christian Ambach <ambi at samba.org>

commit 1f04687e4c9fbc5fa4e7e7b1320b6a1b5cdd32d1
Author: Michael Adam <obnox at samba.org>
Date:   Tue Apr 5 22:21:19 2016 +0200

    s3:vfs:aio_fork: fix O3 error unused result of write
    
    Signed-off-by: Michael Adam <obnox at samba.org>
    Reviewed-by: Christian Ambach <ambi at samba.org>

commit 3776a9cd73115abc9fef31f05f51f25b452ebe43
Author: Michael Adam <obnox at samba.org>
Date:   Tue Apr 5 20:01:32 2016 +0200

    s3:smbfilter: fix O3 error unused result of system()
    
    Signed-off-by: Michael Adam <obnox at samba.org>
    Reviewed-by: Christian Ambach <ambi at samba.org>

commit 6bd436fd456ea7c8f7dec17ad8529dd571324ed4
Author: Michael Adam <obnox at samba.org>
Date:   Tue Apr 5 19:57:42 2016 +0200

    s3:utils:log2pcaphex: fix O3 error uninitialized variable
    
    Signed-off-by: Michael Adam <obnox at samba.org>
    Reviewed-by: Christian Ambach <ambi at samba.org>

commit b7cf77143a408ed4d8c845fbf93a50a3f30f47d8
Author: Michael Adam <obnox at samba.org>
Date:   Tue Apr 5 19:56:25 2016 +0200

    s3:utils:log2pcaphex: fix O3 error unused result of fgets
    
    Signed-off-by: Michael Adam <obnox at samba.org>
    Reviewed-by: Christian Ambach <ambi at samba.org>

commit 8f16d237b95714f79be66fbdf0686697de7446c9
Author: Michael Adam <obnox at samba.org>
Date:   Tue Apr 5 16:47:39 2016 +0200

    s3:samlogon_cache: fix O3 error unused result of truncate
    
    in netsamlogon_cache_init()
    
    Signed-off-by: Michael Adam <obnox at samba.org>
    Reviewed-by: Christian Ambach <ambi at samba.org>

commit 33d20f93dc38514f0174b978e019533373d8118a
Author: Michael Adam <obnox at samba.org>
Date:   Tue Apr 5 19:26:41 2016 +0200

    s4:client: fix O3 error unused result of of chdir and system
    
    Signed-off-by: Michael Adam <obnox at samba.org>
    Reviewed-by: Christian Ambach <ambi at samba.org>

commit a7fc5e0f4dd8f172662f06735020aa6d4d913254
Author: Michael Adam <obnox at samba.org>
Date:   Tue Apr 5 18:52:29 2016 +0200

    s4:torture:nbench: fix O3 error unused result of asprintf
    
    Signed-off-by: Michael Adam <obnox at samba.org>
    Reviewed-by: Christian Ambach <ambi at samba.org>

commit ea668a28e060b3f6093e7818d3960753d2c2326b
Author: Michael Adam <obnox at samba.org>
Date:   Tue Apr 5 18:33:59 2016 +0200

    s4:torture:rpc:samlogon: fix O3 error unused result of asprintf
    
    Signed-off-by: Michael Adam <obnox at samba.org>
    Reviewed-by: Christian Ambach <ambi at samba.org>

commit 080946ce91aebb0e6ec341271b3995312cc69fef
Author: Michael Adam <obnox at samba.org>
Date:   Tue Apr 5 18:21:17 2016 +0200

    s4:torture:basic:delete: fix O3 error unused result of asprintf
    
    Signed-off-by: Michael Adam <obnox at samba.org>
    Reviewed-by: Christian Ambach <ambi at samba.org>

commit ef63ebdcb73ac43ef7f9e4b7020acb188bc632df
Author: Michael Adam <obnox at samba.org>
Date:   Tue Apr 5 18:19:30 2016 +0200

    s4:torture:basic:dir: fix O3 error unused result of asprintf
    
    Signed-off-by: Michael Adam <obnox at samba.org>
    Reviewed-by: Christian Ambach <ambi at samba.org>

commit f7256914d060d8816fd1eba93e93c0098ac3ff31
Author: Michael Adam <obnox at samba.org>
Date:   Tue Apr 5 18:16:46 2016 +0200

    s4:torture:basic: fix O3 error unused result of write
    
    in test_utable
    
    Signed-off-by: Michael Adam <obnox at samba.org>
    Reviewed-by: Christian Ambach <ambi at samba.org>

commit 99182346a37bd108bf6177d77c994b4ac8756ccd
Author: Michael Adam <obnox at samba.org>
Date:   Tue Apr 5 18:14:19 2016 +0200

    s4:torture:basic:misc: fix O3 error unused result of asprintf
    
    Signed-off-by: Michael Adam <obnox at samba.org>
    Reviewed-by: Christian Ambach <ambi at samba.org>

commit ebfbf6bc2781510524530a9a98bec57b87421c72
Author: Michael Adam <obnox at samba.org>
Date:   Tue Apr 5 17:15:29 2016 +0200

    s4:torture:basic: fix O3 error unused result of asprintf
    
    in run_opentest()
    
    While fixing this, also convert to using talloc_asprintf instead.
    
    Signed-off-by: Michael Adam <obnox at samba.org>
    Reviewed-by: Christian Ambach <ambi at samba.org>

commit a6db0527cbb606fea7263f99cf496e5faa9529a0
Author: Michael Adam <obnox at samba.org>
Date:   Tue Apr 5 15:43:52 2016 +0200

    s4:regshell: fix O3 error unused result of asprintf in reg_complete_key()
    
    Signed-off-by: Michael Adam <obnox at samba.org>
    Reviewed-by: Christian Ambach <ambi at samba.org>

commit 2a2d990e3ac241c4d0d8986e203192ddf78d3566
Author: Michael Adam <obnox at samba.org>
Date:   Tue Apr 5 12:36:57 2016 +0200

    s4:ntvfs: fix O3 error unused result of write error in nbench_log()
    
    Signed-off-by: Michael Adam <obnox at samba.org>
    Reviewed-by: Christian Ambach <ambi at samba.org>

commit 93b1dac1ca3db596b4bac9ba7b5626f5cdd6b658
Author: Michael Adam <obnox at samba.org>
Date:   Tue Apr 5 12:18:17 2016 +0200

    s4:ntvfs: fix O3 error unused result of asprintf in cifspsx_file_utime()
    
    Signed-off-by: Michael Adam <obnox at samba.org>
    Reviewed-by: Christian Ambach <ambi at samba.org>

commit fa80f1a937b699bf93ceee85cd033424f6987b29
Author: Michael Adam <obnox at samba.org>
Date:   Sat Mar 26 02:46:54 2016 +0100

    s4:ntvfs: fix O3 error unused result of asprintf in cifspsx_list_unix
    
    Signed-off-by: Michael Adam <obnox at samba.org>
    Reviewed-by: Christian Ambach <ambi at samba.org>

commit 8f4759d5624850b46be7c0e0e6f1c89a3320605c
Author: Michael Adam <obnox at samba.org>
Date:   Sat Mar 26 02:24:08 2016 +0100

    s4:ntvfs: fix O3 error unused result of asprintf in cifspsx_map_fileinfo
    
    Signed-off-by: Michael Adam <obnox at samba.org>
    Reviewed-by: Christian Ambach <ambi at samba.org>

commit b64a24eb056e2abbc5364bcc01e994e1ccaa9b9f
Author: Michael Adam <obnox at samba.org>
Date:   Sat Mar 26 02:08:41 2016 +0100

    s4:ntvfs: fix O3 error unused result of asprintf in svfs_file_utime
    
    Signed-off-by: Michael Adam <obnox at samba.org>
    Reviewed-by: Christian Ambach <ambi at samba.org>

commit 8e521379d598d6ddf2d6967d70381eee2c1968b7
Author: Michael Adam <obnox at samba.org>
Date:   Sat Mar 26 01:53:00 2016 +0100

    s4:ntvfs: fix O3 error unused result of asprintf
    
    in svfs_map_fileinfo
    
    Signed-off-by: Michael Adam <obnox at samba.org>
    Reviewed-by: Christian Ambach <ambi at samba.org>

commit 2d8a3125f25d108dba1ede497b3878d4025351ef
Author: Michael Adam <obnox at samba.org>
Date:   Fri Mar 25 02:04:58 2016 +0100

    s4:registry:patchfile: fix O3 error unused result of write
    
    Signed-off-by: Michael Adam <obnox at samba.org>
    Reviewed-by: Christian Ambach <ambi at samba.org>

commit c15023449534a318ea57b28efa9ce9e800220952
Author: Michael Adam <obnox at samba.org>
Date:   Fri Mar 25 01:29:40 2016 +0100

    s4:libcli:resolve: fix O3 error unused result of write
    
    Signed-off-by: Michael Adam <obnox at samba.org>
    Reviewed-by: Christian Ambach <ambi at samba.org>

commit 258360f1eb738a6a1cc0efa878368d55f2cafef3
Author: Michael Adam <obnox at samba.org>
Date:   Fri Mar 25 01:28:56 2016 +0100

    lib: add sys_write_v - void variant of sys_write
    
    Signed-off-by: Michael Adam <obnox at samba.org>
    Reviewed-by: Christian Ambach <ambi at samba.org>

commit 4680fe047a2779c0797193825481a4e8ecbbc254
Author: Michael Adam <obnox at samba.org>
Date:   Fri Mar 25 01:28:27 2016 +0100

    lib: add sys_read_v - void variant of sys_read
    
    Signed-off-by: Michael Adam <obnox at samba.org>
    Reviewed-by: Christian Ambach <ambi at samba.org>

commit af83bc39202f743c9f51c472d73ede58fd81d971
Author: Michael Adam <obnox at samba.org>
Date:   Tue Mar 22 23:01:10 2016 +0100

    debug: fix -O3 warning - unused return code of write()
    
    Signed-off-by: Michael Adam <obnox at samba.org>
    Reviewed-by: Christian Ambach <ambi at samba.org>

commit 0e80775c1b22e9ef5d328813671de4ad2bfb44ff
Author: Michael Adam <obnox at samba.org>
Date:   Wed Mar 23 02:47:13 2016 +0100

    tdb:torture: fix -O3 error unused result of write
    
    Signed-off-by: Michael Adam <obnox at samba.org>
    Reviewed-by: Christian Ambach <ambi at samba.org>

commit a860245c4dfe807f51c761b1fc0b75212edaa011
Author: Michael Adam <obnox at samba.org>
Date:   Wed Mar 23 02:36:04 2016 +0100

    tdb:torture: fix -O3 error unused result code of read
    
    Signed-off-by: Michael Adam <obnox at samba.org>
    Reviewed-by: Christian Ambach <ambi at samba.org>

commit 774087655d4c5fbab5f0df9378c60638b550fd73
Author: Michael Adam <obnox at samba.org>
Date:   Tue Apr 5 18:51:13 2016 +0200

    tevent:testsuite: fix O3 errors unused result of write
    
    Signed-off-by: Michael Adam <obnox at samba.org>
    Reviewed-by: Christian Ambach <ambi at samba.org>

commit 22918a033bf057b37574a73734641d6e7dc01ae5
Author: Michael Adam <obnox at samba.org>
Date:   Tue Apr 5 18:40:37 2016 +0200

    tevent:testsuite: fix O3 errors unused result for read
    
    Signed-off-by: Michael Adam <obnox at samba.org>
    Reviewed-by: Christian Ambach <ambi at samba.org>

commit 1521e688b6b15296c08c8645c07c620ff15c69be
Author: Michael Adam <obnox at samba.org>
Date:   Wed Mar 23 02:23:35 2016 +0100

    tevent:signal: fix -O3 error unused result of read
    
    some compilers don't tolerate void-casting for warn_unused_result
    
    Signed-off-by: Michael Adam <obnox at samba.org>
    Reviewed-by: Christian Ambach <ambi at samba.org>

commit 24b267eb8656f978d11ab67a1bef298b24392cc9
Author: Michael Adam <obnox at samba.org>
Date:   Wed Mar 23 01:41:29 2016 +0100

    tevent:signal: fix -O3 error unused result of write
    
    some compilers don't tolerate void-casting for warn_unused_result
    
    Signed-off-by: Michael Adam <obnox at samba.org>
    Reviewed-by: Christian Ambach <ambi at samba.org>

commit 149fa72770bf03337e381073cdc0e9fc35bee1a0
Author: Michael Adam <obnox at samba.org>
Date:   Wed Mar 23 01:41:17 2016 +0100

    tevent:threads: fix -O3 error unused result of write
    
    some compilers don't tolerate void-casting for warn_unused_result
    
    Signed-off-by: Michael Adam <obnox at samba.org>
    Reviewed-by: Christian Ambach <ambi at samba.org>

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

Summary of changes:
 examples/libsmbclient/testacl3.c                |  6 ++-
 examples/libsmbclient/testfstatvfs.c            |  6 ++-
 examples/libsmbclient/testnotify.c              |  6 ++-
 examples/libsmbclient/testread.c                |  6 ++-
 examples/libsmbclient/teststatvfs.c             |  6 ++-
 examples/libsmbclient/testwrite.c               | 12 +++++-
 lib/tdb/tools/tdbtorture.c                      | 14 +++++--
 lib/tevent/testsuite.c                          | 37 ++++++++++++++-----
 lib/tevent/tevent_signal.c                      | 12 +++++-
 lib/tevent/tevent_threads.c                     |  5 ++-
 lib/util/debug.c                                | 11 +++++-
 lib/util/sys_rw.c                               | 33 +++++++++++++++++
 lib/util/sys_rw.h                               |  2 +
 source3/libsmb/samlogon_cache.c                 |  8 +++-
 source3/modules/vfs_aio_fork.c                  |  2 +-
 source3/modules/vfs_preopen.c                   |  3 +-
 source3/modules/vfs_snapper.c                   |  2 +-
 source3/utils/log2pcaphex.c                     | 11 +++++-
 source3/utils/smbfilter.c                       |  6 ++-
 source4/client/client.c                         | 32 +++++++++++++---
 source4/dsdb/samdb/ldb_modules/repl_meta_data.c |  2 +-
 source4/lib/registry/patchfile_preg.c           |  9 +++--
 source4/lib/registry/tools/regshell.c           |  9 ++++-
 source4/libcli/resolve/dns_ex.c                 |  5 ++-
 source4/ntvfs/cifs_posix_cli/svfs_util.c        | 13 ++++++-
 source4/ntvfs/cifs_posix_cli/vfs_cifs_posix.c   |  9 +++--
 source4/ntvfs/nbench/vfs_nbench.c               |  3 +-
 source4/ntvfs/simple/svfs_util.c                |  7 +++-
 source4/ntvfs/simple/vfs_simple.c               |  9 +++--
 source4/torture/basic/base.c                    |  6 ++-
 source4/torture/basic/delete.c                  |  7 +++-
 source4/torture/basic/dir.c                     | 14 +++++--
 source4/torture/basic/misc.c                    | 15 ++++++--
 source4/torture/basic/utable.c                  |  3 +-
 source4/torture/nbench/nbench.c                 |  6 ++-
 source4/torture/rpc/samlogon.c                  | 49 +++++++++++++++++++++----
 36 files changed, 310 insertions(+), 76 deletions(-)


Changeset truncated at 500 lines:

diff --git a/examples/libsmbclient/testacl3.c b/examples/libsmbclient/testacl3.c
index f34e273..59d9994 100644
--- a/examples/libsmbclient/testacl3.c
+++ b/examples/libsmbclient/testacl3.c
@@ -27,7 +27,11 @@ int main(int argc, char * argv[])
     {
         fprintf(stdout, "Path: ");
         *path = '\0';
-        fgets(path, sizeof(path) - 1, stdin);
+        p = fgets(path, sizeof(path) - 1, stdin);
+	if (p == NULL) {
+		printf("Error reading from stdin\n");
+		return 1;
+	}
         if (strlen(path) == 0)
         {
             return 0;
diff --git a/examples/libsmbclient/testfstatvfs.c b/examples/libsmbclient/testfstatvfs.c
index 512563f..b2396e3 100644
--- a/examples/libsmbclient/testfstatvfs.c
+++ b/examples/libsmbclient/testfstatvfs.c
@@ -25,7 +25,11 @@ int main(int argc, char * argv[])
     {
         fprintf(stdout, "Path: ");
         *path = '\0';
-        fgets(path, sizeof(path) - 1, stdin);
+	p = fgets(path, sizeof(path) - 1, stdin);
+	if (p == NULL) {
+		fprintf(stderr, "failed to read from stdin\n");
+		return 1;
+	}
         if (strlen(path) == 0)
         {
             return 0;
diff --git a/examples/libsmbclient/testnotify.c b/examples/libsmbclient/testnotify.c
index 68513af..8760cf0 100644
--- a/examples/libsmbclient/testnotify.c
+++ b/examples/libsmbclient/testnotify.c
@@ -43,7 +43,11 @@ int main(int argc, char * argv[])
 
 	fprintf(stdout, "Path: ");
 	*path = '\0';
-	fgets(path, sizeof(path) - 1, stdin);
+	p = fgets(path, sizeof(path) - 1, stdin);
+	if (p == NULL) {
+		fprintf(stderr, "error reading from stdin\n");
+		return 1;
+	}
 	if (strlen(path) == 0) {
 		return 0;
 	}
diff --git a/examples/libsmbclient/testread.c b/examples/libsmbclient/testread.c
index 87625e8..e6d9bf8 100644
--- a/examples/libsmbclient/testread.c
+++ b/examples/libsmbclient/testread.c
@@ -24,7 +24,11 @@ int main(int argc, char * argv[])
     {
         fprintf(stdout, "Path: ");
         *path = '\0';
-        fgets(path, sizeof(path) - 1, stdin);
+	p = fgets(path, sizeof(path) - 1, stdin);
+	if (p == NULL) {
+		fprintf(stderr, "failed to read from stdin\n");
+		return 1;
+	}
         if (strlen(path) == 0)
         {
             return 0;
diff --git a/examples/libsmbclient/teststatvfs.c b/examples/libsmbclient/teststatvfs.c
index 2f656d5..9a8e539 100644
--- a/examples/libsmbclient/teststatvfs.c
+++ b/examples/libsmbclient/teststatvfs.c
@@ -23,7 +23,11 @@ int main(int argc, char * argv[])
     {
         fprintf(stdout, "Path: ");
         *path = '\0';
-        fgets(path, sizeof(path) - 1, stdin);
+	p = fgets(path, sizeof(path) - 1, stdin);
+	if (p == NULL) {
+		fprintf(stderr, "failed to read from stdin\n");
+		return 1;
+	}
         if (strlen(path) == 0)
         {
             return 0;
diff --git a/examples/libsmbclient/testwrite.c b/examples/libsmbclient/testwrite.c
index 636cb20..1837839 100644
--- a/examples/libsmbclient/testwrite.c
+++ b/examples/libsmbclient/testwrite.c
@@ -22,14 +22,22 @@ int main(int argc, char * argv[])
     
     printf("CAUTION: This program will overwrite a file.  "
            "Press ENTER to continue.");
-    fgets(buffer, sizeof(buffer), stdin);
+    p = fgets(buffer, sizeof(buffer), stdin);
+    if (p == NULL) {
+        fprintf(stderr, "failed to read from stdin\n");
+        return 1;
+    }
            
 
     for (;;)
     {
         fprintf(stdout, "\nPath: ");
         *path = '\0';
-        fgets(path, sizeof(path) - 1, stdin);
+        p = fgets(path, sizeof(path) - 1, stdin);
+        if (p == NULL) {
+            fprintf(stderr, "failed to read from stdin\n");
+            return 1;
+        }
         if (strlen(path) == 0)
         {
             return 0;
diff --git a/lib/tdb/tools/tdbtorture.c b/lib/tdb/tools/tdbtorture.c
index e4b8f69..3640dc7 100644
--- a/lib/tdb/tools/tdbtorture.c
+++ b/lib/tdb/tools/tdbtorture.c
@@ -223,8 +223,12 @@ static void usage(void)
 
 static void send_count_and_suicide(int sig)
 {
+	ssize_t ret;
+
 	/* This ensures our successor can continue where we left off. */
-	write(count_pipe, &loopnum, sizeof(loopnum));
+	do {
+		ret = write(count_pipe, &loopnum, sizeof(loopnum));
+	} while (ret == -1 && errno == EINTR);
 	/* This gives a unique signature. */
 	kill(getpid(), SIGUSR2);
 }
@@ -427,8 +431,12 @@ int main(int argc, char * const *argv)
 			    || WTERMSIG(status) == SIGUSR1) {
 				/* SIGUSR2 means they wrote to pipe. */
 				if (WTERMSIG(status) == SIGUSR2) {
-					read(pfds[0], &done[j],
-					     sizeof(done[j]));
+					ssize_t ret;
+
+					do {
+						ret = read(pfds[0], &done[j],
+							   sizeof(done[j]));
+					} while (ret == -1 && errno == EINTR);
 				}
 				pids[j] = fork();
 				if (pids[j] == 0)
diff --git a/lib/tevent/testsuite.c b/lib/tevent/testsuite.c
index bcd27fd..b37c7b1 100644
--- a/lib/tevent/testsuite.c
+++ b/lib/tevent/testsuite.c
@@ -38,6 +38,15 @@
 
 static int fde_count;
 
+static void do_read(int fd, void *buf, size_t count)
+{
+	ssize_t ret;
+
+	do {
+		ret = read(fd, buf, count);
+	} while (ret == -1 && errno == EINTR);
+}
+
 static void fde_handler_read(struct tevent_context *ev_ctx, struct tevent_fd *f,
 			uint16_t flags, void *private_data)
 {
@@ -48,16 +57,26 @@ static void fde_handler_read(struct tevent_context *ev_ctx, struct tevent_fd *f,
 #endif
 	kill(getpid(), SIGALRM);
 
-	read(fd[0], &c, 1);
+	do_read(fd[0], &c, 1);
 	fde_count++;
 }
 
+static void do_write(int fd, void *buf, size_t count)
+{
+	ssize_t ret;
+
+	do {
+		ret = write(fd, buf, count);
+	} while (ret == -1 && errno == EINTR);
+}
+
 static void fde_handler_write(struct tevent_context *ev_ctx, struct tevent_fd *f,
 			uint16_t flags, void *private_data)
 {
 	int *fd = (int *)private_data;
 	char c = 0;
-	write(fd[1], &c, 1);
+
+	do_write(fd[1], &c, 1);
 }
 
 
@@ -72,7 +91,7 @@ static void fde_handler_read_1(struct tevent_context *ev_ctx, struct tevent_fd *
 #endif
 	kill(getpid(), SIGALRM);
 
-	read(fd[1], &c, 1);
+	do_read(fd[1], &c, 1);
 	fde_count++;
 }
 
@@ -82,7 +101,7 @@ static void fde_handler_write_1(struct tevent_context *ev_ctx, struct tevent_fd
 {
 	int *fd = (int *)private_data;
 	char c = 0;
-	write(fd[0], &c, 1);
+	do_write(fd[0], &c, 1);
 }
 
 static void finished_handler(struct tevent_context *ev_ctx, struct tevent_timer *te,
@@ -281,7 +300,7 @@ static void test_event_fd1_fde_handler(struct tevent_context *ev_ctx,
 		/*
 		 * we write to the other socket...
 		 */
-		write(state->sock[1], &c, 1);
+		do_write(state->sock[1], &c, 1);
 		TEVENT_FD_NOT_WRITEABLE(fde);
 		TEVENT_FD_READABLE(fde);
 		return;
@@ -650,9 +669,9 @@ static bool test_event_fd2(struct torture_context *tctx,
 	tevent_fd_set_auto_close(state.sock0.fde);
 	tevent_fd_set_auto_close(state.sock1.fde);
 
-	write(state.sock0.fd, &c, 1);
+	do_write(state.sock0.fd, &c, 1);
 	state.sock0.num_written++;
-	write(state.sock1.fd, &c, 1);
+	do_write(state.sock1.fd, &c, 1);
 	state.sock1.num_written++;
 
 	while (!state.finished) {
@@ -792,7 +811,7 @@ static bool test_event_context_threaded(struct torture_context *test,
 
 	poll(NULL, 0, 100);
 
-	write(fds[1], &c, 1);
+	do_write(fds[1], &c, 1);
 
 	poll(NULL, 0, 100);
 
@@ -800,7 +819,7 @@ static bool test_event_context_threaded(struct torture_context *test,
 	do_shutdown = true;
 	test_event_threaded_unlock();
 
-	write(fds[1], &c, 1);
+	do_write(fds[1], &c, 1);
 
 	ret = pthread_join(poll_thread, NULL);
 	torture_assert(test, ret == 0, "pthread_join failed");
diff --git a/lib/tevent/tevent_signal.c b/lib/tevent/tevent_signal.c
index 9bc11ed..635a7a1 100644
--- a/lib/tevent/tevent_signal.c
+++ b/lib/tevent/tevent_signal.c
@@ -106,9 +106,13 @@ static void tevent_common_signal_handler(int signum)
 	/* Write to each unique event context. */
 	for (sl = sig_state->sig_handlers[signum]; sl; sl = sl->next) {
 		if (sl->se->event_ctx && sl->se->event_ctx != ev) {
+			ssize_t ret;
+
 			ev = sl->se->event_ctx;
 			/* doesn't matter if this pipe overflows */
-			(void) write(ev->pipe_fds[1], &c, 1);
+			do {
+				ret = write(ev->pipe_fds[1], &c, 1);
+			} while (ret == -1 && errno == EINTR);
 		}
 	}
 
@@ -234,9 +238,13 @@ static int tevent_signal_destructor(struct tevent_signal *se)
 static void signal_pipe_handler(struct tevent_context *ev, struct tevent_fd *fde, 
 				uint16_t flags, void *_private)
 {
+	ssize_t ret;
+
 	char c[16];
 	/* its non-blocking, doesn't matter if we read too much */
-	(void) read(fde->fd, c, sizeof(c));
+	do {
+		ret = read(fde->fd, c, sizeof(c));
+	} while (ret == -1 && errno == EINTR);
 }
 
 /*
diff --git a/lib/tevent/tevent_threads.c b/lib/tevent/tevent_threads.c
index 8d44e4f..15882e4 100644
--- a/lib/tevent/tevent_threads.c
+++ b/lib/tevent/tevent_threads.c
@@ -310,6 +310,7 @@ void tevent_thread_proxy_schedule(struct tevent_thread_proxy *tp,
 	struct tevent_immediate_list *im_entry;
 	int ret;
 	char c;
+	ssize_t written;
 
 	ret = pthread_mutex_lock(&tp->mutex);
 	if (ret != 0) {
@@ -341,7 +342,9 @@ void tevent_thread_proxy_schedule(struct tevent_thread_proxy *tp,
 
 	/* And notify the dest_ev_ctx to wake up. */
 	c = '\0';
-	(void)write(tp->write_fd, &c, 1);
+	do {
+		written = write(tp->write_fd, &c, 1);
+	} while (written == -1 && errno == EINTR);
 
   end:
 
diff --git a/lib/util/debug.c b/lib/util/debug.c
index 4bb54d7..95b3d95 100644
--- a/lib/util/debug.c
+++ b/lib/util/debug.c
@@ -139,8 +139,12 @@ static int debug_level_to_priority(int level)
 static void debug_file_log(int msg_level,
 			   const char *msg, const char *msg_no_nl)
 {
+	ssize_t ret;
+
 	check_log_size();
-	write(state.fd, msg, strlen(msg));
+	do {
+		ret = write(state.fd, msg, strlen(msg));
+	} while (ret == -1 && errno == EINTR);
 }
 
 #ifdef WITH_SYSLOG
@@ -1114,7 +1118,10 @@ static void Debug1(const char *msg)
 	case DEBUG_DEFAULT_STDOUT:
 	case DEBUG_DEFAULT_STDERR:
 		if (state.fd > 0) {
-			write(state.fd, msg, strlen(msg));
+			ssize_t ret;
+			do {
+				ret = write(state.fd, msg, strlen(msg));
+			} while (ret == -1 && errno == EINTR);
 		}
 		break;
 	case DEBUG_FILE:
diff --git a/lib/util/sys_rw.c b/lib/util/sys_rw.c
index f625066..9a6cdca 100644
--- a/lib/util/sys_rw.c
+++ b/lib/util/sys_rw.c
@@ -40,6 +40,22 @@ ssize_t sys_read(int fd, void *buf, size_t count)
 	return ret;
 }
 
+/**
+ * read wrapper, void variant:
+ * This is intended to be used as a void variant of
+ * read in situations where the caller wants to ignore
+ * the result. Hence not checking for EAGAIN|EWOULDBLOCK.
+ */
+void sys_read_v(int fd, void *buf, size_t count)
+{
+	ssize_t ret;
+
+	do {
+		ret = read(fd, buf, count);
+	} while (ret == -1 && errno == EINTR);
+}
+
+
 /*******************************************************************
 A write wrapper that will deal with EINTR/EWOULDBLOCK.
 ********************************************************************/
@@ -56,6 +72,23 @@ ssize_t sys_write(int fd, const void *buf, size_t count)
 	return ret;
 }
 
+/**
+ * write wrapper to deal with EINTR and friends.
+ * void-variant that ignores the number of bytes written.
+ * This is intended to be used as a void variant of
+ * write in situations where the caller wants to ignore
+ * the result. Hence not checking for EAGAIN|EWOULDBLOCK.
+ */
+void sys_write_v(int fd, const void *buf, size_t count)
+{
+	ssize_t ret;
+
+	do {
+		ret = write(fd, buf, count);
+	} while (ret == -1 && errno == EINTR);
+}
+
+
 /*******************************************************************
 A writev wrapper that will deal with EINTR.
 ********************************************************************/
diff --git a/lib/util/sys_rw.h b/lib/util/sys_rw.h
index ee1584e..ab456d8 100644
--- a/lib/util/sys_rw.h
+++ b/lib/util/sys_rw.h
@@ -28,7 +28,9 @@
 struct iovec;
 
 ssize_t sys_read(int fd, void *buf, size_t count);
+void sys_read_v(int fd, void *buf, size_t count);
 ssize_t sys_write(int fd, const void *buf, size_t count);
+void sys_write_v(int fd, const void *buf, size_t count);
 ssize_t sys_writev(int fd, const struct iovec *iov, int iovcnt);
 ssize_t sys_pread(int fd, void *buf, size_t count, off_t off);
 ssize_t sys_pwrite(int fd, const void *buf, size_t count, off_t off);
diff --git a/source3/libsmb/samlogon_cache.c b/source3/libsmb/samlogon_cache.c
index c408082..7be5479 100644
--- a/source3/libsmb/samlogon_cache.c
+++ b/source3/libsmb/samlogon_cache.c
@@ -77,7 +77,13 @@ clear:
 	first_try = false;
 
 	DEBUG(0,("retry after truncate for '%s'\n", path));
-	truncate(path, 0);
+	ret = truncate(path, 0);
+	if (ret == -1) {
+		DBG_ERR("truncate failed: %s\n", strerror(errno));
+		talloc_free(path);
+		return false;
+	}
+
 	goto again;
 }
 
diff --git a/source3/modules/vfs_aio_fork.c b/source3/modules/vfs_aio_fork.c
index e699fc5..7d06b98 100644
--- a/source3/modules/vfs_aio_fork.c
+++ b/source3/modules/vfs_aio_fork.c
@@ -411,7 +411,7 @@ static int aio_child_destructor(struct aio_child *child)
 	 * closing the sockfd makes the child not return from recvmsg() on RHEL
 	 * 5.5 so instead force the child to exit by writing bad data to it
 	 */
-	write(child->sockfd, &c, sizeof(c));
+	sys_write_v(child->sockfd, &c, sizeof(c));
 	close(child->sockfd);
 	DLIST_REMOVE(child->list->children, child);
 	return 0;
diff --git a/source3/modules/vfs_preopen.c b/source3/modules/vfs_preopen.c
index b67aad8..8bf30b6 100644
--- a/source3/modules/vfs_preopen.c
+++ b/source3/modules/vfs_preopen.c
@@ -21,6 +21,7 @@
 #include "includes.h"
 #include "system/filesys.h"
 #include "smbd/smbd.h"
+#include "lib/util/sys_rw.h"
 #include "lib/util/sys_rw_data.h"
 
 struct preopen_state;
@@ -185,7 +186,7 @@ static bool preopen_helper_open_one(int sock_fd, char **pnamebuf,
 	close(fd);
 
  done:
-	(void)write(sock_fd, &c, 1);
+	sys_write_v(sock_fd, &c, 1);
 	return true;
 }
 
diff --git a/source3/modules/vfs_snapper.c b/source3/modules/vfs_snapper.c
index 64a83bd..07ec574 100644
--- a/source3/modules/vfs_snapper.c
+++ b/source3/modules/vfs_snapper.c
@@ -1856,7 +1856,7 @@ static NTSTATUS snapper_snap_path_expand(struct connection_struct *conn,
 	NTSTATUS status;
 	char *conf_name;
 	char *base_path;
-	char *snap_path;
+	char *snap_path = NULL;
 
 	dconn = snapper_dbus_conn_create();
 	if (dconn == NULL) {
diff --git a/source3/utils/log2pcaphex.c b/source3/utils/log2pcaphex.c
index 23526c2..f31efa1 100644
--- a/source3/utils/log2pcaphex.c
+++ b/source3/utils/log2pcaphex.c
@@ -302,7 +302,8 @@ int main(int argc, const char **argv)
 	int opt;
 	poptContext pc;
 	char buffer[4096];
-	long data_offset, data_length;
+	long data_offset = 0;
+	long data_length;
 	long data_bytes_read = 0;
 	int in_packet = 0;
 	struct poptOption long_options[] = {
@@ -350,7 +351,13 @@ int main(int argc, const char **argv)
 	if(!hexformat)print_pcap_header(out);
 
 	while(!feof(in)) {
-		fgets(buffer, sizeof(buffer), in); line_num++;
+		char *p;
+		p = fgets(buffer, sizeof(buffer), in);
+		if (p == NULL) {
+			fprintf(stderr, "error reading from input file\n");
+			break;
+		}
+		line_num++;
 		if(buffer[0] == '[') { /* Header */
 			if(strstr(buffer, "show_msg")) {
 				in_packet++;


-- 
Samba Shared Repository



More information about the samba-cvs mailing list