about summary refs log tree commit diff
path: root/src/libs6/s6_svc_writectl.c
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2023-07-06 13:23:21 +0000
committerLaurent Bercot <ska@appnovation.com>2023-07-06 13:23:21 +0000
commit4c8dc8ab046864c370ce1aadd29403fd6c78097f (patch)
treeeff91978d48534e00ad4102062d0060420333a20 /src/libs6/s6_svc_writectl.c
parente8fc7081e6195bd51b61eca25fca7bfd3e771f2f (diff)
downloads6-4c8dc8ab046864c370ce1aadd29403fd6c78097f.tar.gz
s6-4c8dc8ab046864c370ce1aadd29403fd6c78097f.tar.xz
s6-4c8dc8ab046864c370ce1aadd29403fd6c78097f.zip
Use open safe wrappers; remove debug boilerplate
Signed-off-by: Laurent Bercot <ska@appnovation.com>
Diffstat (limited to 'src/libs6/s6_svc_writectl.c')
-rw-r--r--src/libs6/s6_svc_writectl.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/libs6/s6_svc_writectl.c b/src/libs6/s6_svc_writectl.c
index dee9128..e7f4a02 100644
--- a/src/libs6/s6_svc_writectl.c
+++ b/src/libs6/s6_svc_writectl.c
@@ -27,12 +27,12 @@ int s6_svc_writectl (char const *service, char const *subdir, char const *s, siz
  /* Investigate what went wrong */
 
   {
-    int fd, fdsub ;
-    fd = open(service, O_RDONLY | O_DIRECTORY) ;
-    if (fd < 0) return -1 ;
+    int fdsub ;
+    int fd = open2(service, O_RDONLY | O_DIRECTORY) ;
+    if (fd == -1) return -1 ;
     fdsub = open2_at(fd, subdir, O_RDONLY | O_DIRECTORY) ;
     fd_close(fd) ;
-    if (fdsub < 0) return (errno == ENOENT) ? 0 : -2 ;
+    if (fdsub == -1) return (errno == ENOENT) ? 0 : -2 ;
     fd_close(fdsub) ;
     return -2 ;
   }