Skip to content

Commit

Permalink
Merge pull request #107 from js731ca/fix-dangling-symlinks
Browse files Browse the repository at this point in the history
Fix dangling symlinks handling
  • Loading branch information
jfdelnero authored Sep 18, 2024
2 parents 149efca + 2aa07db commit 1252d59
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/fs_handles_db.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#include <stdio.h>
#include <sys/stat.h>
#include <dirent.h>
#include <errno.h>

#include "mtp.h"
#include "mtp_helpers.h"
Expand Down Expand Up @@ -139,6 +140,10 @@ int fs_entry_stat(char *path, filefoundinfo* fileinfo)
return 1;
}

PRINT_WARN("stat64(%s) error: %s",path, strerror(errno));
fileinfo->size = 0;
fileinfo->filename[0] = '\0';

return 0;
}

Expand All @@ -151,8 +156,7 @@ DIR * fs_find_first_file(char *folder, filefoundinfo* fileinfo)
dir = opendir (folder);
if( dir )
{
d = readdir (dir);
if( d )
while ((d = readdir (dir)) != NULL)
{
tmpstr = malloc (strlen(folder) + strlen(d->d_name) + 4 );
if( tmpstr )
Expand Down

0 comments on commit 1252d59

Please sign in to comment.