Check-in [457d68de44]
Overview
Comment:Close cache file if we cannot duplicate it
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | trunk
Files: files | file ages | folders
SHA1: 457d68de446ec16e180a4b787d8cb79ae1c1d5a6
User & Date: rkeene on 2020-04-21 13:12:37
Other Links: manifest | tags
Context
2020-04-21
13:12
Close cache file if we cannot duplicate it Leaf check-in: 457d68de44 user: rkeene tags: trunk
2020-04-02
15:49
More inputs to AFL check-in: abedee59bf user: rkeene tags: trunk
Changes

Modified filed.c from [e0a9bfdbe7] to [d39c0feefb].

995
996
997
998
999
1000
1001



1002
1003
1004
1005
1006
1007
1008
	if (filed_fileinfo_fdcache_size != 0) {
		/*
		 * We have to make a duplicate FD, because once we release the cache
		 * mutex, the file descriptor may be closed
		 */
		fd = dup(cache->fd);
		if (fd < 0) {



			pthread_mutex_unlock(&cache->mutex);

			return(NULL);
		}

		buffer->fd = fd;
		buffer->len = cache->len;







>
>
>







995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
	if (filed_fileinfo_fdcache_size != 0) {
		/*
		 * We have to make a duplicate FD, because once we release the cache
		 * mutex, the file descriptor may be closed
		 */
		fd = dup(cache->fd);
		if (fd < 0) {
			close(cache->fd);
			cache->fd = -1;

			pthread_mutex_unlock(&cache->mutex);

			return(NULL);
		}

		buffer->fd = fd;
		buffer->len = cache->len;