diff --git a/src/pcscdaemon.c b/src/pcscdaemon.c index 6df360f5..2b28b174 100644 --- a/src/pcscdaemon.c +++ b/src/pcscdaemon.c @@ -685,12 +685,13 @@ int main(int argc, char **argv) "writing " PCSCLITE_RUN_PID " failed: %s", strerror(errno)); } - (void)close(f); /* set mode so that the file is world readable even is umask is * restrictive * The file is used by libpcsclite */ - (void)chmod(PCSCLITE_RUN_PID, mode); + (void)fchmod(f, mode); + + (void)close(f); } else Log2(PCSC_LOG_CRITICAL, "cannot create " PCSCLITE_RUN_PID ": %s",