aboutsummaryrefslogtreecommitdiff
path: root/src/util/disk.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2018-01-04 17:50:50 +0100
committerChristian Grothoff <christian@grothoff.org>2018-01-04 17:53:02 +0100
commit07019e218c1c10cf22d942b462b96dbd1944450f (patch)
tree688fda4d3c3d2adc5a64b492135f948e135eec99 /src/util/disk.c
parentd480b878260215d0fe02d147c7229cfe17b926a6 (diff)
downloadgnunet-07019e218c1c10cf22d942b462b96dbd1944450f.tar.gz
gnunet-07019e218c1c10cf22d942b462b96dbd1944450f.zip
fix more warnings
Diffstat (limited to 'src/util/disk.c')
-rw-r--r--src/util/disk.c27
1 files changed, 22 insertions, 5 deletions
diff --git a/src/util/disk.c b/src/util/disk.c
index d536ec897..8fd689070 100644
--- a/src/util/disk.c
+++ b/src/util/disk.c
@@ -1324,6 +1324,7 @@ static int
1324remove_helper (void *unused, 1324remove_helper (void *unused,
1325 const char *fn) 1325 const char *fn)
1326{ 1326{
1327 (void) unused;
1327 (void) GNUNET_DISK_directory_remove (fn); 1328 (void) GNUNET_DISK_directory_remove (fn);
1328 return GNUNET_OK; 1329 return GNUNET_OK;
1329} 1330}
@@ -1396,6 +1397,7 @@ GNUNET_DISK_file_copy (const char *src,
1396 uint64_t pos; 1397 uint64_t pos;
1397 uint64_t size; 1398 uint64_t size;
1398 size_t len; 1399 size_t len;
1400 ssize_t sret;
1399 struct GNUNET_DISK_FileHandle *in; 1401 struct GNUNET_DISK_FileHandle *in;
1400 struct GNUNET_DISK_FileHandle *out; 1402 struct GNUNET_DISK_FileHandle *out;
1401 1403
@@ -1425,9 +1427,17 @@ GNUNET_DISK_file_copy (const char *src,
1425 len = COPY_BLK_SIZE; 1427 len = COPY_BLK_SIZE;
1426 if (len > size - pos) 1428 if (len > size - pos)
1427 len = size - pos; 1429 len = size - pos;
1428 if (len != GNUNET_DISK_file_read (in, buf, len)) 1430 sret = GNUNET_DISK_file_read (in,
1431 buf,
1432 len);
1433 if ( (sret < 0) ||
1434 (len != (size_t) sret) )
1429 goto FAIL; 1435 goto FAIL;
1430 if (len != GNUNET_DISK_file_write (out, buf, len)) 1436 sret = GNUNET_DISK_file_write (out,
1437 buf,
1438 len);
1439 if ( (sret < 0) ||
1440 (len != (size_t) sret) )
1431 goto FAIL; 1441 goto FAIL;
1432 pos += len; 1442 pos += len;
1433 } 1443 }
@@ -1457,7 +1467,8 @@ GNUNET_DISK_filename_canonicalize (char *fn)
1457 { 1467 {
1458 c = *idx; 1468 c = *idx;
1459 1469
1460 if (c == '/' || c == '\\' || c == ':' || c == '*' || c == '?' || c == '"' || 1470 if (c == '/' || c == '\\' || c == ':' ||
1471 c == '*' || c == '?' || c == '"' ||
1461 c == '<' || c == '>' || c == '|') 1472 c == '<' || c == '>' || c == '|')
1462 { 1473 {
1463 *idx = '_'; 1474 *idx = '_';
@@ -2236,18 +2247,24 @@ create_selectable_pipe (PHANDLE read_pipe_ptr, PHANDLE write_pipe_ptr,
2236 * @return handle to the new pipe, NULL on error 2247 * @return handle to the new pipe, NULL on error
2237 */ 2248 */
2238struct GNUNET_DISK_PipeHandle * 2249struct GNUNET_DISK_PipeHandle *
2239GNUNET_DISK_pipe (int blocking_read, int blocking_write, int inherit_read, int inherit_write) 2250GNUNET_DISK_pipe (int blocking_read,
2251 int blocking_write,
2252 int inherit_read,
2253 int inherit_write)
2240{ 2254{
2241#ifndef MINGW 2255#ifndef MINGW
2242 int fd[2]; 2256 int fd[2];
2243 int ret; 2257 int ret;
2244 int eno; 2258 int eno;
2245 2259
2260 (void) inherit_read;
2261 (void) inherit_write;
2246 ret = pipe (fd); 2262 ret = pipe (fd);
2247 if (ret == -1) 2263 if (ret == -1)
2248 { 2264 {
2249 eno = errno; 2265 eno = errno;
2250 LOG_STRERROR (GNUNET_ERROR_TYPE_ERROR, "pipe"); 2266 LOG_STRERROR (GNUNET_ERROR_TYPE_ERROR,
2267 "pipe");
2251 errno = eno; 2268 errno = eno;
2252 return NULL; 2269 return NULL;
2253 } 2270 }