[Pcsclite-cvs-commit] r6383 - /trunk/PCSC/src/pcscdaemon.c
rousseau at users.alioth.debian.org
rousseau at users.alioth.debian.org
Sun Jul 1 16:11:53 UTC 2012
Author: rousseau
Date: Sun Jul 1 16:11:52 2012
New Revision: 6383
URL: http://svn.debian.org/wsvn/pcsclite/?sc=1&rev=6383
Log:
Fix a TOCTOU problem
Do not check for PCSCLITE_IPC_DIR presence before creating it. Just
create it and manage the case it already existed.
Coverity: Time of check time of use (TOCTOU)
Modified:
trunk/PCSC/src/pcscdaemon.c
Modified: trunk/PCSC/src/pcscdaemon.c
URL: http://svn.debian.org/wsvn/pcsclite/trunk/PCSC/src/pcscdaemon.c?rev=6383&op=diff
==============================================================================
--- trunk/PCSC/src/pcscdaemon.c (original)
+++ trunk/PCSC/src/pcscdaemon.c Sun Jul 1 16:11:52 2012
@@ -467,13 +467,11 @@
/*
* If PCSCLITE_IPC_DIR does not exist then create it
*/
- rv = stat(PCSCLITE_IPC_DIR, &fStatBuf);
- if (rv < 0)
{
int mode = S_IROTH | S_IXOTH | S_IRGRP | S_IXGRP | S_IRWXU;
rv = mkdir(PCSCLITE_IPC_DIR, mode);
- if (rv != 0)
+ if ((rv != 0) && (errno != EEXIST))
{
Log2(PCSC_LOG_CRITICAL,
"cannot create " PCSCLITE_IPC_DIR ": %s", strerror(errno));
More information about the Pcsclite-cvs-commit
mailing list