diff --git a/src/plugins/job_container/tmpfs/job_container_tmpfs.c b/src/plugins/job_container/tmpfs/job_container_tmpfs.c
index d67a1d87d787e25801b53dadc67ec66f5e98d65e..392af8f622e525e953030212a91413d29563cfc5 100644
--- a/src/plugins/job_container/tmpfs/job_container_tmpfs.c
+++ b/src/plugins/job_container/tmpfs/job_container_tmpfs.c
@@ -635,14 +635,10 @@ static int _create_ns(uint32_t job_id, bool remount)
 			goto exit1;
 		}
 
-		rc = waitpid(cpid, &wstatus, 0);
-		if (rc == -1) {
+		if ((waitpid(cpid, &wstatus, 0) != cpid) || WEXITSTATUS(wstatus)) {
 			error("%s: waitpid failed", __func__);
+			rc = SLURM_ERROR;
 			goto exit1;
-		} else {
-			if (rc == cpid)
-				debug3("child exited: %d",
-				       WEXITSTATUS(wstatus));
 		}
 
 		rc = 0;