aboutsummaryrefslogtreecommitdiff
path: root/src/util/disk.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/util/disk.c')
-rw-r--r--src/util/disk.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/util/disk.c b/src/util/disk.c
index ccd930907..6dca6db54 100644
--- a/src/util/disk.c
+++ b/src/util/disk.c
@@ -1930,13 +1930,17 @@ GNUNET_DISK_get_handle_from_w32_handle (HANDLE osfh)
1930 * Get a handle from a native integer FD. 1930 * Get a handle from a native integer FD.
1931 * 1931 *
1932 * @param fno native integer file descriptor 1932 * @param fno native integer file descriptor
1933 * @return file handle corresponding to the descriptor 1933 * @return file handle corresponding to the descriptor, NULL on error
1934 */ 1934 */
1935struct GNUNET_DISK_FileHandle * 1935struct GNUNET_DISK_FileHandle *
1936GNUNET_DISK_get_handle_from_int_fd (int fno) 1936GNUNET_DISK_get_handle_from_int_fd (int fno)
1937{ 1937{
1938 struct GNUNET_DISK_FileHandle *fh; 1938 struct GNUNET_DISK_FileHandle *fh;
1939 1939
1940 if ( (((off_t) -1) == lseek (fno, 0, SEEK_CUR)) &&
1941 (EBADF == errno) )
1942 return NULL; /* invalid FD */
1943
1940#ifndef WINDOWS 1944#ifndef WINDOWS
1941 fh = GNUNET_malloc (sizeof (struct GNUNET_DISK_FileHandle)); 1945 fh = GNUNET_malloc (sizeof (struct GNUNET_DISK_FileHandle));
1942 1946