The branch, master has been updated
       via  66f59f0 tdb: finish weaning off err.h.
      from  d1aeb2d s3:test_net_registry_check: eliminate "local" keyword in 
shell

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


- Log -----------------------------------------------------------------
commit 66f59f040984bef5023fc844097b85bebee88f09
Author: Rusty Russell <[email protected]>
Date:   Tue Jun 26 15:18:52 2012 +0930

    tdb: finish weaning off err.h.
    
    Commit 3c4263e7580143c69225729f5b67f09c00add2fd said it removed err.h
    from tdb, unfortuntely it didn't: tap-interface.h still included it.
    
    This finishes it properly!
    
    Reported-by:Stefan Metzmacher <[email protected]>
    Signed-off-by: Rusty Russell <[email protected]>
    
    Autobuild-User(master): Rusty Russell <[email protected]>
    Autobuild-Date(master): Tue Jun 26 10:22:03 CEST 2012 on sn-devel-104

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

Summary of changes:
 lib/tdb/test/external-agent.c              |   12 ++++++++----
 lib/tdb/test/run-corrupt.c                 |   12 ++++++++----
 lib/tdb/test/run-die-during-transaction.c  |   16 ++++++++++------
 lib/tdb/test/run-nested-traverse.c         |    2 --
 lib/tdb/test/run-open-during-transaction.c |    2 --
 lib/tdb/test/run-traverse-in-transaction.c |    2 --
 lib/tdb/test/tap-interface.h               |    5 ++---
 7 files changed, 28 insertions(+), 23 deletions(-)


Changeset truncated at 500 lines:

diff --git a/lib/tdb/test/external-agent.c b/lib/tdb/test/external-agent.c
index 139de76..8140e70 100644
--- a/lib/tdb/test/external-agent.c
+++ b/lib/tdb/test/external-agent.c
@@ -108,12 +108,16 @@ struct agent *prepare_external_agent(void)
        int command[2], response[2];
        char name[1+PATH_MAX];
 
-       if (pipe(command) != 0 || pipe(response) != 0)
-               return NULL;
+       if (pipe(command) != 0 || pipe(response) != 0) {
+               fprintf(stderr, "pipe failed: %s\n", strerror(errno));
+               exit(1);
+       }
 
        pid = fork();
-       if (pid < 0)
-               return NULL;
+       if (pid < 0) {
+               fprintf(stderr, "fork failed: %s\n", strerror(errno));
+               exit(1);
+       }
 
        if (pid != 0) {
                struct agent *agent = malloc(sizeof(*agent));
diff --git a/lib/tdb/test/run-corrupt.c b/lib/tdb/test/run-corrupt.c
index 584f789..1a3c769 100644
--- a/lib/tdb/test/run-corrupt.c
+++ b/lib/tdb/test/run-corrupt.c
@@ -41,11 +41,15 @@ static void tdb_flip_bit(struct tdb_context *tdb, unsigned 
int bit)
                ((unsigned char *)tdb->map_ptr)[off] ^= mask;
        else {
                unsigned char c;
-               if (pread(tdb->fd, &c, 1, off) != 1)
-                       err(1, "pread");
+               if (pread(tdb->fd, &c, 1, off) != 1) {
+                       fprintf(stderr, "pread: %s\n", strerror(errno));
+                       exit(1);
+               }
                c ^= mask;
-               if (pwrite(tdb->fd, &c, 1, off) != 1)
-                       err(1, "pwrite");
+               if (pwrite(tdb->fd, &c, 1, off) != 1) {
+                       fprintf(stderr, "pwrite: %s\n", strerror(errno));
+                       exit(1);
+               }
        }
 }
 
diff --git a/lib/tdb/test/run-die-during-transaction.c 
b/lib/tdb/test/run-die-during-transaction.c
index 19c9dbe..6e3a70d 100644
--- a/lib/tdb/test/run-die-during-transaction.c
+++ b/lib/tdb/test/run-die-during-transaction.c
@@ -164,12 +164,18 @@ reset:
        key.dsize--;
 
        ret = external_agent_operation(agent, OPEN, TEST_DBNAME);
-       if (ret != SUCCESS)
-               errx(1, "Agent failed to open: %s", agent_return_name(ret));
+       if (ret != SUCCESS) {
+               fprintf(stderr, "Agent failed to open: %s\n",
+                       agent_return_name(ret));
+               exit(1);
+       }
 
        ret = external_agent_operation(agent, FETCH, KEY_STRING);
-       if (ret != SUCCESS)
-               errx(1, "Agent failed find key: %s", agent_return_name(ret));
+       if (ret != SUCCESS) {
+               fprintf(stderr, "Agent failed find key: %s\n",
+                       agent_return_name(ret));
+               exit(1);
+       }
 
        in_transaction = true;
        if (tdb_transaction_start(tdb) != 0)
@@ -215,8 +221,6 @@ int main(int argc, char *argv[])
        unlock_callback = maybe_die;
 
        agent = prepare_external_agent();
-       if (!agent)
-               err(1, "preparing agent");
 
        for (i = 0; i < sizeof(ops)/sizeof(ops[0]); i++) {
                diag("Testing %s after death", operation_name(ops[i]));
diff --git a/lib/tdb/test/run-nested-traverse.c 
b/lib/tdb/test/run-nested-traverse.c
index 86f2913..37d57c0 100644
--- a/lib/tdb/test/run-nested-traverse.c
+++ b/lib/tdb/test/run-nested-traverse.c
@@ -62,8 +62,6 @@ int main(int argc, char *argv[])
 
        plan_tests(17);
        agent = prepare_external_agent();
-       if (!agent)
-               err(1, "preparing agent");
 
        tdb = tdb_open_ex("run-nested-traverse.tdb", 1024, TDB_CLEAR_IF_FIRST,
                          O_CREAT|O_TRUNC|O_RDWR, 0600, &taplogctx, NULL);
diff --git a/lib/tdb/test/run-open-during-transaction.c 
b/lib/tdb/test/run-open-during-transaction.c
index d46b216..a825e62 100644
--- a/lib/tdb/test/run-open-during-transaction.c
+++ b/lib/tdb/test/run-open-during-transaction.c
@@ -149,8 +149,6 @@ int main(int argc, char *argv[])
 
        plan_tests(20);
        agent = prepare_external_agent();
-       if (!agent)
-               err(1, "preparing agent");
 
        unlock_callback = after_unlock;
        for (i = 0; i < sizeof(flags)/sizeof(flags[0]); i++) {
diff --git a/lib/tdb/test/run-traverse-in-transaction.c 
b/lib/tdb/test/run-traverse-in-transaction.c
index 7813a6c..bcdc354 100644
--- a/lib/tdb/test/run-traverse-in-transaction.c
+++ b/lib/tdb/test/run-traverse-in-transaction.c
@@ -47,8 +47,6 @@ int main(int argc, char *argv[])
 
        plan_tests(13);
        agent = prepare_external_agent();
-       if (!agent)
-               err(1, "preparing agent");
 
        tdb = tdb_open_ex("run-traverse-in-transaction.tdb",
                          1024, TDB_CLEAR_IF_FIRST, O_CREAT|O_TRUNC|O_RDWR,
diff --git a/lib/tdb/test/tap-interface.h b/lib/tdb/test/tap-interface.h
index 12d5f94..d9ed6e8 100644
--- a/lib/tdb/test/tap-interface.h
+++ b/lib/tdb/test/tap-interface.h
@@ -22,7 +22,6 @@
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
 #include <stdio.h>
-#include <err.h>
 
 #ifndef __location__
 #define __TAP_STRING_LINE1__(s)    #s
@@ -32,9 +31,9 @@
 #endif
 
 #define plan_tests(num)
-#define ok(e, ...) ((e) ? (void)printf(".") : errx(1, __VA_ARGS__))
+#define ok(e, ...) do { if (e) { (void)printf("."); } else { fprintf(stderr, 
__VA_ARGS__); exit(1); } } while(0)
 #define ok1(e) ok((e), "%s:%s", __location__, #e)
 #define pass(...) printf(".")
-#define fail(...) errx(1, __VA_ARGS__)
+#define fail(...) do { fprintf(stderr, __VA_ARGS__); exit(1); } while(0)
 #define diag printf
 #define exit_status() 0


-- 
Samba Shared Repository

Reply via email to