exit correctly
This commit is contained in:
parent
28aaab76cf
commit
b10db40d3b
1 changed files with 7 additions and 7 deletions
|
|
@ -10,7 +10,7 @@ void
|
||||||
usage(void)
|
usage(void)
|
||||||
{
|
{
|
||||||
fprint(2, "usage: plumb [-p plumbfile] [-a 'attr=value ...'] [-s src] [-d dst] [-t type] [-w wdir] -i | data1\n");
|
fprint(2, "usage: plumb [-p plumbfile] [-a 'attr=value ...'] [-s src] [-d dst] [-t type] [-w wdir] -i | data1\n");
|
||||||
exits("usage");
|
threadexitsall("usage");
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -25,14 +25,14 @@ gather(void)
|
||||||
m.data = realloc(m.data, m.ndata+n);
|
m.data = realloc(m.data, m.ndata+n);
|
||||||
if(m.data == nil){
|
if(m.data == nil){
|
||||||
fprint(2, "plumb: alloc failed: %r\n");
|
fprint(2, "plumb: alloc failed: %r\n");
|
||||||
exits("alloc");
|
threadexitsall("alloc");
|
||||||
}
|
}
|
||||||
memmove(m.data+m.ndata, buf, n);
|
memmove(m.data+m.ndata, buf, n);
|
||||||
m.ndata += n;
|
m.ndata += n;
|
||||||
}
|
}
|
||||||
if(n < 0){
|
if(n < 0){
|
||||||
fprint(2, "plumb: i/o error on input: %r\n");
|
fprint(2, "plumb: i/o error on input: %r\n");
|
||||||
exits("read");
|
threadexitsall("read");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -94,7 +94,7 @@ threadmain(int argc, char *argv[])
|
||||||
fd = plumbopen("send", OWRITE);
|
fd = plumbopen("send", OWRITE);
|
||||||
if(fd < 0){
|
if(fd < 0){
|
||||||
fprint(2, "plumb: can't open plumb file: %r\n");
|
fprint(2, "plumb: can't open plumb file: %r\n");
|
||||||
exits("open");
|
threadexitsall("open");
|
||||||
}
|
}
|
||||||
if(input){
|
if(input){
|
||||||
gather();
|
gather();
|
||||||
|
|
@ -102,9 +102,9 @@ threadmain(int argc, char *argv[])
|
||||||
m.attr = plumbaddattr(m.attr, plumbunpackattr("action=showdata"));
|
m.attr = plumbaddattr(m.attr, plumbunpackattr("action=showdata"));
|
||||||
if(plumbsend(fd, &m) < 0){
|
if(plumbsend(fd, &m) < 0){
|
||||||
fprint(2, "plumb: can't send message: %r\n");
|
fprint(2, "plumb: can't send message: %r\n");
|
||||||
exits("error");
|
threadexitsall("error");
|
||||||
}
|
}
|
||||||
exits(nil);
|
threadexitsall(nil);
|
||||||
}
|
}
|
||||||
for(i=0; i<argc; i++){
|
for(i=0; i<argc; i++){
|
||||||
if(input == 0){
|
if(input == 0){
|
||||||
|
|
@ -113,7 +113,7 @@ threadmain(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
if(plumbsend(fd, &m) < 0){
|
if(plumbsend(fd, &m) < 0){
|
||||||
fprint(2, "plumb: can't send message: %r\n");
|
fprint(2, "plumb: can't send message: %r\n");
|
||||||
exits("error");
|
threadexitsall("error");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
threadexitsall(nil);
|
threadexitsall(nil);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue