aboutsummaryrefslogtreecommitdiff
path: root/tsh.cc
diff options
context:
space:
mode:
Diffstat (limited to 'tsh.cc')
-rw-r--r--tsh.cc10
1 files changed, 5 insertions, 5 deletions
diff --git a/tsh.cc b/tsh.cc
index 06cfa2c..fc9b34f 100644
--- a/tsh.cc
+++ b/tsh.cc
@@ -15,8 +15,10 @@
#include <iostream>
#include <vector>
#include <string>
+#include "util.h"
using namespace std;
+using ov4::atomic_print;
/* Misc manifest constants */
#define MAXLINE 1024 /* max line size */
@@ -318,17 +320,15 @@ void waitfg(pid_t pid)
*/
void sigchld_handler(int sig)
{
- constexpr int numlen = 20;
int errno_backup = errno;
int status, pid;
- char msg[] = "sig chld, pid: ", num[numlen];
+ char msg[] = "sig chld, pid: ";
write(STDOUT_FILENO, msg, strlen(msg));
while ((pid = waitpid(-1, &status, WNOHANG)) > 0)
{
- // deletejob(NULL, pid);
- sprintf(num, "%d\n", pid);
- write(STDOUT_FILENO, num, strlen(num));
+ deletejob(NULL, pid);
+ atomic_print(pid);
}