Skip to content

Commit

Permalink
fixed bug that caused all symlinks to be shown as dead
Browse files Browse the repository at this point in the history
  • Loading branch information
Electrux committed Oct 16, 2021
1 parent a04e870 commit 0ee0196
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include <stdint.h>
#include <stdbool.h>

static const int VERSION_MAIN = 2;
static const int VERSION_MAIN = 1;
static const int VERSION_SUB = 0;
static const int VERSION_PATCH = 0;

Expand Down
7 changes: 5 additions & 2 deletions src/ls.c
Original file line number Diff line number Diff line change
Expand Up @@ -298,9 +298,12 @@ static int _get_stats( const char * path, stat_info_t * stats )
if( stats->lnk_jumps == 1 ) strcpy( stats->lnk_loc, buf );

char jump_dir[ MAX_STR_LEN ];
strcpy( jump_dir, dirname( buf ) );
char tmpbuf[ 2048 ];
strcpy( tmpbuf, buf ); // because dirname and basename change their arguments
strcpy( jump_dir, dirname( tmpbuf ) );
char jump_file[ MAX_STR_LEN ];
strcpy( jump_file, basename( buf ) );
strcpy( tmpbuf, buf );
strcpy( jump_file, basename( tmpbuf ) );
int cd_res = chdir( jump_dir );
if( cd_res != 0 ) goto dead_link;
int res = get_stats( jump_file, stats );
Expand Down

0 comments on commit 0ee0196

Please sign in to comment.