summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--nq.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/nq.c b/nq.c
index 6fe739c..c5c7223 100644
--- a/nq.c
+++ b/nq.c
@@ -214,8 +214,11 @@ usage:
 
 	write_execline(lockfd, argc, argv);
 
-	dup2(lockfd, 2);
-	dup2(lockfd, 1);
+	if (dup2(lockfd, 2) < 0 ||
+	    dup2(lockfd, 1) < 0) {
+		perror("dup2");
+		exit(222);
+	}
 
 wait:
 	if ((tflag || wflag) && argc - optind > 0) {