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 <metze@samba.org>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Autobuild-User(master): Rusty Russell <rusty@rustcorp.com.au>
Autobuild-Date(master): Tue Jun 26 10:22:03 CEST 2012 on sn-devel-104
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));
((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);
+ }
}
}
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)
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]));
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);
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++) {
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,
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
#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