Retry blocking waitpid() on EINTR 44/265844/2
authorKonrad Lipinski <k.lipinski2@samsung.com>
Fri, 29 Oct 2021 12:19:54 +0000 (14:19 +0200)
committerKonrad Lipinski <k.lipinski2@samsung.com>
Fri, 29 Oct 2021 12:43:17 +0000 (14:43 +0200)
Change-Id: I0b7bcc0ce1964a229b77a8456266696f4ae0a80b

src/common/include/utils.h

index 24be37ce819e4dd8b1788ef9c3d2f5f09fbac31c..13418073d33c9ae38dc7af6046d8fcbef8025ce7 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016-2020 Samsung Electronics Co., Ltd. All rights reserved.
+ * Copyright (c) 2016-2021 Samsung Electronics Co., Ltd. All rights reserved
  *
  * This file is licensed under the terms of MIT License or the Apache License
  * Version 2.0 of your choice. See the LICENSE.MIT file for MIT license details.
@@ -111,9 +111,9 @@ bool forkExecWaitpid(const char *prog, const T *...args) {
         return false;
     if (pid) {
         int r;
-        return waitpid(pid, &r, 0) >= 0 && WIFEXITED(r) && !WEXITSTATUS(r);
+        return TEMP_FAILURE_RETRY(waitpid(pid, &r, 0)) >= 0 && WIFEXITED(r) && !WEXITSTATUS(r);
     }
-    execl(prog, prog, args..., nullptr);
+    execl(prog, prog, args..., static_cast<char*>(nullptr));
     exit(EXIT_FAILURE);
 }