chiark / gitweb /
fsckd: free client event source before we close its fd
[elogind.git] / src / udev / mtd_probe / mtd_probe.c
index 70c04db40b615ef8fa87adb34ca9ea3a4f342f3e..67b750c4b36caca1fbcb70a119508090f9ea6f42 100644 (file)
@@ -16,7 +16,7 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor,
  * Boston, MA  02110-1301  USA
  */
-#include "mtd_probe.h"
+
 #include <stdio.h>
 #include <sys/ioctl.h>
 #include <mtd/mtd-user.h>
@@ -26,6 +26,8 @@
 #include <unistd.h>
 #include <stdlib.h>
 
+#include "mtd_probe.h"
+
 int main(int argc, char** argv)
 {
         int mtd_fd;
@@ -37,7 +39,7 @@ int main(int argc, char** argv)
                 return 1;
         }
 
-        mtd_fd = open(argv[1], O_RDONLY);
+        mtd_fd = open(argv[1], O_RDONLY|O_CLOEXEC);
         if (mtd_fd == -1) {
                 perror("open");
                 exit(-1);