[Pcsclite-cvs-commit] r4436 - in /trunk/PCSC/src: utils.c utils.h

rousseau at users.alioth.debian.org rousseau at users.alioth.debian.org
Tue Oct 6 09:40:08 UTC 2009


Author: rousseau
Date: Tue Oct  6 09:40:08 2009
New Revision: 4436

URL: http://svn.debian.org/wsvn/pcsclite/?sc=1&rev=4436
Log:
remove now useless StatSynchronize() and StatSynchronizeContext()

Modified:
    trunk/PCSC/src/utils.c
    trunk/PCSC/src/utils.h

Modified: trunk/PCSC/src/utils.c
URL: http://svn.debian.org/wsvn/pcsclite/trunk/PCSC/src/utils.c?rev=4436&op=diff
==============================================================================
--- trunk/PCSC/src/utils.c (original)
+++ trunk/PCSC/src/utils.c Tue Oct  6 09:40:08 2009
@@ -77,120 +77,6 @@
 } /* SendHotplugSignal */
 
 /**
- * Sends an asynchronous event to any waiting client
- *
- * Just write 1 byte to any fifo in PCSCLITE_EVENTS_DIR and remove the file
- *
- * This function must be secured since the files are created by the library
- * or any non privileged process. We must not follow symlinks for example
- */
-int StatSynchronize(struct pubReaderStatesList *readerState)
-{
-	DIR *dir_fd;
-	struct dirent *dir;
-
-	if (readerState)
-		(void)SYS_MMapSynchronize((void *)readerState, SYS_GetPageSize() );
-
-	dir_fd = opendir(PCSCLITE_EVENTS_DIR);
-	if (NULL == dir_fd)
-	{
-		Log2(PCSC_LOG_ERROR, "Can't opendir " PCSCLITE_EVENTS_DIR ": %s",
-			strerror(errno));
-		return -1;
-	}
-
-	while ((dir = readdir(dir_fd)) != NULL)
-	{
-		char filename[FILENAME_MAX];
-		int fd;
-		char buf[] = { '\0' };
-		struct stat fstat_buf;
-
-		if ('.' == dir->d_name[0])
-			continue;
-
-		(void)snprintf(filename, sizeof(filename), "%s/%s", PCSCLITE_EVENTS_DIR,
-			dir->d_name);
-		Log2(PCSC_LOG_DEBUG, "status file: %s", filename);
-
-		fd = SYS_OpenFile(filename, O_WRONLY | O_APPEND | O_NONBLOCK, 0);
-		if (fd < 0)
-		{
-			/* ENXIO "No such device or address" is a normal error
-			 * if the client is no more listening the pipe */
-			Log3(ENXIO == errno ? PCSC_LOG_DEBUG : PCSC_LOG_ERROR,
-				"Can't open %s: %s", filename, strerror(errno));
-		}
-		else
-		{
-			if (fstat(fd, &fstat_buf))
-			{
-				Log3(PCSC_LOG_ERROR, "Can't fstat %s: %s", filename,
-					strerror(errno));
-			}
-			else
-			{
-				/* check that the file is a FIFO */
-				if (!S_ISFIFO(fstat_buf.st_mode))
-					Log2(PCSC_LOG_ERROR, "%s is not a fifo", filename);
-				else
-					(void)SYS_WriteFile(fd, buf, sizeof(buf));
-			}
-
-			(void)SYS_CloseFile(fd);
-		}
-
-		/* remove files older than 60 seconds */
-		if ((difftime(time(NULL), fstat_buf.st_atime) > 60) && unlink(filename))
-			Log3(PCSC_LOG_ERROR, "Can't remove %s: %s", filename,
-			strerror(errno));
-	}
-	(void)closedir(dir_fd);
-
-	return 0;
-} /* StatSynchronize */
-
-
-/**
- * Sends an asynchronous event to a specific waiting client
- *
- * Just write 1 byte to an (existing) specific fifo in PCSCLITE_EVENTS_DIR
- *
- * This function must be secured since the files are created by the library
- * or any non privileged process. We must not follow symlinks for example
- */
-int StatSynchronizeContext(SCARDCONTEXT hContext)
-{
-	char filename[FILENAME_MAX];
-	int fd;
-	char buf[] = { '\0' };
-	struct stat fstat_buf;
-
-	(void)snprintf(filename, sizeof(filename), "%s/event.%d.%ld",
-		PCSCLITE_EVENTS_DIR, SYS_GetPID(), hContext);
-	fd = SYS_OpenFile(filename, O_WRONLY, 0);
-
-	if (fstat(fd, &fstat_buf))
-	{
-		Log3(PCSC_LOG_ERROR, "Can't fstat %s: %s", filename, strerror(errno));
-	}
-	else
-	{
-		/* check that the file is a FIFO */
-		if (!(fstat_buf.st_mode & S_IFIFO))
-			Log2(PCSC_LOG_ERROR, "%s is not a fifo", filename);
-		else
-			(void)SYS_WriteFile(fd, buf, sizeof(buf));
-	}
-
-	(void)SYS_CloseFile(fd);
-
-	return 0;
-} /* StatSynchronize */
-
-
-/**
  * Check is OpenCT is running and display a critical message if it is
  *
  * The first cause of pcsc-lite failure is that OpenCT is installed and running

Modified: trunk/PCSC/src/utils.h
URL: http://svn.debian.org/wsvn/pcsclite/trunk/PCSC/src/utils.h?rev=4436&op=diff
==============================================================================
--- trunk/PCSC/src/utils.h (original)
+++ trunk/PCSC/src/utils.h Tue Oct  6 09:40:08 2009
@@ -21,9 +21,6 @@
 /* defined in winscard_clnt.c */
 LONG SCardCheckDaemonAvailability(void);
 
-int StatSynchronize(/*@null@*/ struct pubReaderStatesList *readerState);
-int StatSynchronizeContext(SCARDCONTEXT hContext);
-
 int CheckForOpenCT(void);
 
 long int time_sub(struct timeval *a, struct timeval *b);




More information about the Pcsclite-cvs-commit mailing list