procd: Replace strerror(errno) with %m.
[project/procd.git] / utils / utils.c
index e2e3396..57c82eb 100644 (file)
@@ -12,6 +12,7 @@
  * GNU General Public License for more details.
  */
 
+#define _GNU_SOURCE
 #include <libubox/avl.h>
 #include <libubox/avl-cmp.h>
 #include "utils.h"
 
 #include "../log.h"
 
+#ifndef O_PATH
+#define O_PATH         010000000
+#endif
+
 void
 __blobmsg_list_init(struct blobmsg_list *list, int offset, int len, blobmsg_list_cmp cmp)
 {
@@ -198,8 +203,8 @@ int patch_stdio(const char *device)
 
        for (fd = STDIN_FILENO; fd <= STDERR_FILENO; fd++) {
                if (patch_fd(device, fd, fd ? O_WRONLY : O_RDONLY)) {
-                       ERROR("Failed to redirect %s to %s: %d (%s)\n",
-                             fdname[fd], device, errno, strerror(errno));
+                       ERROR("Failed to redirect %s to %s: %d (%m)\n",
+                             fdname[fd], device, errno);
                        rv = -1;
                }
        }