conterm/kern/sysproc.c
Giacomo Tesio 19a5046403 all: fix warnings
cpu.c:587:4: warning: ‘n’ may be used uninitialized in this function
cpu.c:659:3: warning: dereferencing type-punned pointer will break strict-aliasing rules
cpu.c:659:3: warning: dereferencing type-punned pointer will break strict-aliasing rules
kern/devaudio.c:238:25: warning: variable ‘in’ set but not used
kern/devaudio.c:240:8: warning: variable ‘a’ set but not used
kern/sysproc.c:14:11: warning: cast to pointer from integer of different size
libc/nsec.c:56:12: warning: implicit declaration of function ‘libstrtoll’
libc/runestrchr.c:16:2: warning: suggest parentheses around assignment used as truth value
libmemdraw/draw.c:2209:4: warning: dereferencing type-punned pointer will break strict-aliasing rules
libmemdraw/draw.c:2224:4: warning: dereferencing type-punned pointer will break strict-aliasing rules
libmemdraw/draw.c:2455:4: warning: dereferencing type-punned pointer will break strict-aliasing rules
libmemdraw/draw.c:2481:4: warning: dereferencing type-punned pointer will break strict-aliasing rules
2016-01-09 15:52:31 +01:00

33 lines
502 B
C

#include "u.h"
#include "lib.h"
#include "dat.h"
#include "fns.h"
#include "error.h"
long
sysexits(uintptr_t *arg)
{
char *status;
char *inval = "invalid exit string";
char buf[ERRMAX];
status = (char*)arg[0];
if(status){
if(waserror())
status = inval;
else{
validaddr((ulong)status, 1, 0);
if(vmemchr(status, 0, ERRMAX) == 0){
memmove(buf, status, ERRMAX);
buf[ERRMAX-1] = 0;
status = buf;
}
}
poperror();
}
pexit(status, 1);
return 0; /* not reached */
}