chiark / gitweb /
tree-wide: make more code use safe_close()
[elogind.git] / src / login / logind-button.c
index 210b889c4f987cd7998b38ac69e0578c77e98603..3324c4622c765addd6e305625990a060333179da 100644 (file)
@@ -240,8 +240,7 @@ int button_open(Button *b) {
         assert(b);
 
         if (b->fd >= 0) {
-                close(b->fd);
-                b->fd = -1;
+                b->fd = safe_close(b->fd);
         }
 
         p = strjoina("/dev/input/", b->name);
@@ -267,8 +266,7 @@ int button_open(Button *b) {
         return 0;
 
 fail:
-        close(b->fd);
-        b->fd = -1;
+        b->fd = safe_close(b->fd);
         return r;
 }