View Issue Details

IDProjectCategoryView StatusLast Update
0009309GNUnetutil librarypublic2024-12-09 18:03
Reporterfefe Assigned Toschanzen  
PrioritynormalSeverityminorReproducibilityhave not tried
Status closedResolutionfixed 
Target Version0.23.0Fixed in Version0.23.0 
Summary0009309: GNUNET_DISK_directory_scan: get rid of the stat() call
Description 835 if (0 != stat (dname, &istat))
 836 {
 837 LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_WARNING, "stat", dname);
 838 GNUNET_free (dname);
 839 return GNUNET_SYSERR;
 840 }
 841 if (! S_ISDIR (istat.st_mode))
 842 {
 843 LOG (GNUNET_ERROR_TYPE_WARNING,
 844 _ ("Expected `%s' to be a directory!\n"),
 845 dir_name);
 846 GNUNET_free (dname);
 847 return GNUNET_SYSERR;
 848 }
 849 errno = 0;
 850 dinfo = opendir (dname);
 851 if ((EACCES == errno) || (NULL == dinfo))
 852 {

The stat is superfluous. If dname is not a directory, opendir returns NULL and sets errno to ENOTDIR.
Also the errno acrobatics look bad. Just call opendir and if it returns NULL then look at errno.
TagsNo tags attached.

Activities

schanzen

2024-11-04 10:53

administrator   ~0023652

Fix committed to master branch.

schanzen

2024-12-09 18:03

administrator   ~0023832

Released

Related Changesets

gnunet: master bf7076ea

2024-11-04 11:52

schanzen


Details Diff
util: Simplify logic inside GNUNET_DISK_directory_scan. Fixes 0009309 Affected Issues
0009309
mod - src/lib/util/disk.c Diff File

Issue History

Date Modified Username Field Change
2024-11-01 15:00 fefe New Issue
2024-11-03 20:34 schanzen Target Version => 0.22.3
2024-11-04 10:53 schanzen Changeset attached => gnunet master bf7076ea
2024-11-04 10:53 schanzen Note Added: 0023652
2024-11-04 10:53 schanzen Assigned To => schanzen
2024-11-04 10:53 schanzen Status new => resolved
2024-11-04 10:53 schanzen Resolution open => fixed
2024-11-14 09:43 schanzen Target Version 0.22.3 => 0.23.0
2024-12-09 18:03 schanzen Fixed in Version => 0.23.0
2024-12-09 18:03 schanzen Note Added: 0023832
2024-12-09 18:03 schanzen Status resolved => closed