summaryrefslogtreecommitdiff
path: root/sys/src/lib9p
diff options
context:
space:
mode:
authorJacob Moody <moody@posixcafe.org>2022-12-12 21:36:38 +0000
committerJacob Moody <moody@posixcafe.org>2022-12-12 21:36:38 +0000
commitacefccf01e5e21456d7ce4eba7257770c944a461 (patch)
tree0993bee7d4541fb19027e8e1aa206846696ebeb2 /sys/src/lib9p
parenta7b30a349b6388b2eed6a735d3248eeba5198baa (diff)
lib9p: e*9p error tidy
sysfatal has consistent behavior regardless if the user is threaded.
Diffstat (limited to 'sys/src/lib9p')
-rw-r--r--sys/src/lib9p/mem.c18
-rw-r--r--sys/src/lib9p/srv.c4
2 files changed, 6 insertions, 16 deletions
diff --git a/sys/src/lib9p/mem.c b/sys/src/lib9p/mem.c
index ef7c0515f..943dbb664 100644
--- a/sys/src/lib9p/mem.c
+++ b/sys/src/lib9p/mem.c
@@ -9,10 +9,8 @@ emalloc9p(ulong sz)
{
void *v;
- if((v = malloc(sz)) == nil) {
- fprint(2, "out of memory allocating %lud\n", sz);
- exits("mem");
- }
+ if((v = malloc(sz)) == nil)
+ sysfatal("out of memory allocating %lud", sz);
memset(v, 0, sz);
setmalloctag(v, getcallerpc(&sz));
return v;
@@ -23,10 +21,8 @@ erealloc9p(void *v, ulong sz)
{
void *nv;
- if((nv = realloc(v, sz)) == nil && sz != 0) {
- fprint(2, "out of memory allocating %lud\n", sz);
- exits("mem");
- }
+ if((nv = realloc(v, sz)) == nil && sz != 0)
+ sysfatal("out of memory allocating %lud", sz);
if(v == nil)
setmalloctag(nv, getcallerpc(&v));
setrealloctag(nv, getcallerpc(&v));
@@ -38,10 +34,8 @@ estrdup9p(char *s)
{
char *t;
- if((t = strdup(s)) == nil) {
- fprint(2, "out of memory in strdup(%.10s)\n", s);
- exits("mem");
- }
+ if((t = strdup(s)) == nil)
+ sysfatal("out of memory in strdup(%.10s)", s);
setmalloctag(t, getcallerpc(&s));
return t;
}
diff --git a/sys/src/lib9p/srv.c b/sys/src/lib9p/srv.c
index 35c78e1ec..4069fb168 100644
--- a/sys/src/lib9p/srv.c
+++ b/sys/src/lib9p/srv.c
@@ -666,10 +666,6 @@ rstat(Req *r, char *error)
}
n = GBIT16(tmp)+BIT16SZ;
statbuf = emalloc9p(n);
- if(statbuf == nil){
- r->error = "out of memory";
- return;
- }
r->ofcall.nstat = convD2M(&r->d, statbuf, n);
r->ofcall.stat = statbuf; /* freed in closereq */
if(r->ofcall.nstat <= BIT16SZ){