On Wed, May 22, 2024 at 10:59:08PM +0200, Stefano
Brivio wrote:
As I'm adding pidfile_open() in the next
patch. The function comment
didn't match, by the way.
Signed-off-by: Stefano Brivio <sbrivio(a)redhat.com>
---
passt.c | 2 +-
util.c | 6 +++---
util.h | 2 +-
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/passt.c b/passt.c
index 1df1dc4..fb9773d 100644
--- a/passt.c
+++ b/passt.c
@@ -317,7 +317,7 @@ int main(int argc, char **argv)
if (!c.foreground)
__daemon(pidfile_fd, devnull_fd);
else
- write_pidfile(pidfile_fd, getpid());
+ pidfile_write(pidfile_fd, getpid());
if (pasta_child_pid)
kill(pasta_child_pid, SIGUSR1);
diff --git a/util.c b/util.c
index 849fa7f..18c04ba 100644
--- a/util.c
+++ b/util.c
@@ -380,11 +380,11 @@ int open_in_ns(const struct ctx *c, const char *path, int flags)
}
/**
- * pid_file() - Write PID to file, if requested to do so, and close it
+ * pidfile_write() - Write PID to file, if requested to do so, and close it
* @fd: Open PID file descriptor, closed on exit, -1 to skip writing it
* @pid: PID value to write
*/
-void write_pidfile(int fd, pid_t pid)
+void pidfile_write(int fd, pid_t pid)
{
char pid_buf[12];
int n;
@@ -419,7 +419,7 @@ int __daemon(int pidfile_fd, int devnull_fd)
}
if (pid) {
- write_pidfile(pidfile_fd, pid);
+ pidfile_write(pidfile_fd, pid);
exit(EXIT_SUCCESS);
}
diff --git a/util.h b/util.h
index 264423b..f811975 100644
--- a/util.h
+++ b/util.h
@@ -156,7 +156,7 @@ char *line_read(char *buf, size_t len, int fd);
void ns_enter(const struct ctx *c);
bool ns_is_init(void);
int open_in_ns(const struct ctx *c, const char *path, int flags);
-void write_pidfile(int fd, pid_t pid);
+void pidfile_write(int fd, pid_t pid);
int __daemon(int pidfile_fd, int devnull_fd);
int fls(unsigned long x);
int write_file(const char *path, const char *buf);
Neutral refactoring, so:
Reviewed-by: Richard W.M. Jones <rjones(a)redhat.com>
However the same function name appears (just as a comment) in
contrib/apparmor/usr.bin.passt so I don't know if you would want to
update that?
Right, nice catch, thanks for grepping! I'll send a separate patch for
it.
--
Stefano