summaryrefslogtreecommitdiff
path: root/nfs
diff options
context:
space:
mode:
authorJustus Winter <justus@gnupg.org>2017-06-19 21:20:57 +0200
committerJustus Winter <justus@gnupg.org>2017-08-05 18:42:22 +0200
commit835b293d35a209d38047126443d41fa7090daa4c (patch)
tree5bf956895e6030f91cd618fb191b2151f6d25423 /nfs
parentdc0b5a43224999223a246870912b0f292b1980e9 (diff)
Use our own variant of 'assert' and 'assert_perror'.
Our variants print stack traces on failures. This will make locating errors much easier.
Diffstat (limited to 'nfs')
-rw-r--r--nfs/cache.c4
-rw-r--r--nfs/ops.c10
-rw-r--r--nfs/rpc.c12
-rw-r--r--nfs/storage-info.c6
4 files changed, 16 insertions, 16 deletions
diff --git a/nfs/cache.c b/nfs/cache.c
index ecf3b11a..883cb966 100644
--- a/nfs/cache.c
+++ b/nfs/cache.c
@@ -75,7 +75,7 @@ lookup_fhandle (struct fhandle *handle, struct node **npp)
/* Could not find it */
np = netfs_make_node_alloc (sizeof (struct netnode));
- assert (np);
+ assert_backtrace (np);
nn = netfs_node_netnode (np);
nn->handle.size = handle->size;
@@ -127,7 +127,7 @@ netfs_node_norefs (struct node *np)
error_t err;
args = malloc (sizeof (struct fnd));
- assert (args);
+ assert_backtrace (args);
args->dir = np->nn->dead_dir;
args->name = np->nn->dead_name;
diff --git a/nfs/ops.c b/nfs/ops.c
index 33ab38b7..afde0bed 100644
--- a/nfs/ops.c
+++ b/nfs/ops.c
@@ -608,7 +608,7 @@ verify_nonexistent (struct iouser *cred, struct node *dir,
/* Don't use the lookup cache for this; we want a full sync to
get as close to real exclusive create behavior as possible. */
- assert (protocol_version == 2);
+ assert_backtrace (protocol_version == 2);
p = nfs_initialize_rpc (NFSPROC_LOOKUP (protocol_version),
cred, 0, &rpcbuf, dir, -1);
@@ -1134,8 +1134,8 @@ netfs_attempt_mkfile (struct iouser *cred, struct node *dir,
return err;
}
- assert (!(*newnp)->nn->dead_dir);
- assert (!(*newnp)->nn->dead_name);
+ assert_backtrace (!(*newnp)->nn->dead_dir);
+ assert_backtrace (!(*newnp)->nn->dead_name);
netfs_nref (dir);
(*newnp)->nn->dead_dir = dir;
(*newnp)->nn->dead_name = name;
@@ -1668,7 +1668,7 @@ netfs_report_access (struct iouser *cred,
err = netfs_attempt_read (cred, np, 0, &len, &byte);
if (err)
return;
- assert (len == 1 || len == 0);
+ assert_backtrace (len == 1 || len == 0);
*types |= O_READ | O_EXEC;
@@ -1777,7 +1777,7 @@ fetch_directory (struct iouser *cred, struct node *dir,
char *newbuf;
newbuf = realloc (buf, bufmalloced *= 2);
- assert (newbuf);
+ assert_backtrace (newbuf);
if (newbuf != buf)
bp = newbuf + (bp - buf);
buf = newbuf;
diff --git a/nfs/rpc.c b/nfs/rpc.c
index c0d0290e..0d83064a 100644
--- a/nfs/rpc.c
+++ b/nfs/rpc.c
@@ -31,7 +31,7 @@
#undef malloc /* Get rid of the sun block. */
#include <netinet/in.h>
-#include <assert.h>
+#include <assert-backtrace.h>
#include <errno.h>
#include <error.h>
#include <unistd.h>
@@ -107,7 +107,7 @@ initialize_rpc (int program, int version, int rpc_proc,
*(p++) = htonl (version);
*(p++) = htonl (rpc_proc);
- assert ((uid == -1) == (gid == -1));
+ assert_backtrace ((uid == -1) == (gid == -1));
if (uid == -1)
{
@@ -214,7 +214,7 @@ conduct_rpc (void **rpcbuf, int **pp)
return errno;
}
else
- assert (cc == nc);
+ assert_backtrace (cc == nc);
/* Wait for reply. */
cancel = 0;
@@ -254,7 +254,7 @@ conduct_rpc (void **rpcbuf, int **pp)
/* If the transmition id does not match that in the message,
something strange happened in rpc_receive_thread. */
- assert (*p == xid);
+ assert_backtrace (*p == xid);
p++;
switch (ntohl (*p))
@@ -376,7 +376,7 @@ rpc_receive_thread (void *arg)
/* Allocate a receive buffer. */
buf = malloc (1024 + read_size);
- assert (buf);
+ assert_backtrace (buf);
while (1)
{
@@ -416,7 +416,7 @@ rpc_receive_thread (void *arg)
if (r)
{
buf = malloc (1024 + read_size);
- assert (buf);
+ assert_backtrace (buf);
}
}
}
diff --git a/nfs/storage-info.c b/nfs/storage-info.c
index 7427b3d8..f86f6c0d 100644
--- a/nfs/storage-info.c
+++ b/nfs/storage-info.c
@@ -65,7 +65,7 @@ netfs_file_get_storage_info (struct iouser *cred,
if (*data == MAP_FAILED)
return errno;
*data_len = fmt (name_len) + 1;
- assert (*data_len == name_len);
+ assert_backtrace (*data_len == name_len);
}
/* Now fill in the file handle data in hexadecimal. */
@@ -86,12 +86,12 @@ netfs_file_get_storage_info (struct iouser *cred,
*num_ports = 0;
*ports_type = MACH_MSG_TYPE_COPY_SEND;
- assert (*num_offsets >= 2); /* mig always gives us some */
+ assert_backtrace (*num_offsets >= 2); /* mig always gives us some */
*num_offsets = 2;
(*offsets)[0] = 0;
(*offsets)[1] = np->nn_stat.st_size;
- assert (*num_ints >= 6); /* mig always gives us some */
+ assert_backtrace (*num_ints >= 6); /* mig always gives us some */
*num_ints = 1;
(*ints)[0] = STORAGE_NETWORK;
(*ints)[1] = 0; /* XXX readonly if we supported it */