|
|
47585c |
From 38952aa277df116da0b7ef389440de34a3e61cd0 Mon Sep 17 00:00:00 2001
|
|
|
47585c |
From: Scott Moser <smoser@brickies.net>
|
|
|
47585c |
Date: Wed, 19 Sep 2018 17:21:48 -0400
|
|
|
47585c |
Subject: [PATCH] Close file handles when writing pid files.
|
|
|
47585c |
|
|
|
47585c |
The file descriptors used for writing to the pid file were
|
|
|
47585c |
not being closed. Just be more clean and close them.
|
|
|
47585c |
|
|
|
47585c |
Also fix a debug message that said 'lock file' rather than 'pid file'.
|
|
|
47585c |
---
|
|
|
47585c |
iscsiuio/src/unix/main.c | 3 ++-
|
|
|
47585c |
usr/iscsid.c | 1 +
|
|
|
47585c |
2 files changed, 3 insertions(+), 1 deletion(-)
|
|
|
47585c |
|
|
|
47585c |
diff --git a/iscsiuio/src/unix/main.c b/iscsiuio/src/unix/main.c
|
|
|
47585c |
index 5cccc76ed220..457ebe340b7d 100644
|
|
|
47585c |
--- a/iscsiuio/src/unix/main.c
|
|
|
47585c |
+++ b/iscsiuio/src/unix/main.c
|
|
|
47585c |
@@ -346,8 +346,9 @@ int main(int argc, char *argv[])
|
|
|
47585c |
sprintf(buf, "%d\n", getpid());
|
|
|
47585c |
written_bytes = write(fd, buf, strlen(buf));
|
|
|
47585c |
if (written_bytes == -1)
|
|
|
47585c |
- printf("Could not write lock file [%s]",
|
|
|
47585c |
+ printf("Could not write pid file [%s]",
|
|
|
47585c |
strerror(errno));
|
|
|
47585c |
+ close(fd);
|
|
|
47585c |
|
|
|
47585c |
daemon_init();
|
|
|
47585c |
}
|
|
|
47585c |
diff --git a/usr/iscsid.c b/usr/iscsid.c
|
|
|
47585c |
index b95917df3bc5..7d6032252d00 100644
|
|
|
47585c |
--- a/usr/iscsid.c
|
|
|
47585c |
+++ b/usr/iscsid.c
|
|
|
47585c |
@@ -467,6 +467,7 @@ int main(int argc, char *argv[])
|
|
|
47585c |
exit(ISCSI_ERR);
|
|
|
47585c |
}
|
|
|
47585c |
}
|
|
|
47585c |
+ close(fd);
|
|
|
47585c |
|
|
|
47585c |
daemon_init();
|
|
|
47585c |
} else {
|
|
|
47585c |
--
|
|
|
47585c |
2.17.2
|
|
|
47585c |
|