#include <lib/fmt.h>
#include <assert.h>
#include <fcntl.h>
+#include <signal.h>
#define ENSC_WRAPPERS_VSERVER 1
#define ENSC_WRAPPERS_STDLIB 1
static size_t
writeContextInfo(xid_t ctx, char const *name)
{
- char buf[sizeof(ctx)*3+1];
- size_t l = utilvserver_fmt_ulong(buf, ctx);
size_t l1 = name==0 ? 0 : strlen(name);
size_t res = CTXNR_WIDTH + 1;
+
+ if (ctx==VC_NOCTX) {
+ if (3<CTXNR_WIDTH) write(1, CONTEXT_PLACE, CTXNR_WIDTH-3);
+ write(1, "ERR ", 4);
+ }
+ else {
+ char buf[sizeof(ctx)*3+1];
+ size_t l = utilvserver_fmt_ulong(buf, ctx);
- if (l<CTXNR_WIDTH) write(1, CONTEXT_PLACE, CTXNR_WIDTH-l);
- write(1, buf, l);
- write(1, " ", 1);
+ if (l<CTXNR_WIDTH) write(1, CONTEXT_PLACE, CTXNR_WIDTH-l);
+ write(1, buf, l);
+ write(1, " ", 1);
+ }
if (l1!=0) {
assert(name!=0);
if (strcmp(argv[1], "--version")==0) showVersion();
}
+ signal(SIGCHLD, SIG_DFL);
+
if (!switchToWatchXid(&errptr)) {
perror(errptr);
exit(wrapper_exit_code);
Eclose(p[0]);
processOutput(data, len);
-
- exitLikeProcess(pid);
- perror("exitLikeProcess()");
- return wrapper_exit_code;
+ exitLikeProcess(pid, "ps", wrapper_exit_code);
}