mirror of
https://github.com/adtools/clib2.git
synced 2025-12-08 14:59:05 +00:00
- The lstat() code now reliably detects that it found a soft link.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14850 87f5fb63-7c3d-0410-a384-fd976d0f7a62
This commit is contained in:
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: stat_lstat.c,v 1.7 2005-03-02 14:47:10 obarthel Exp $
|
* $Id: stat_lstat.c,v 1.8 2005-03-02 18:49:01 obarthel Exp $
|
||||||
*
|
*
|
||||||
* :ts=4
|
* :ts=4
|
||||||
*
|
*
|
||||||
@ -137,6 +137,10 @@ lstat_lock(const char *name,const int mode,int *link_length)
|
|||||||
name = new_name;
|
name = new_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Remember that we found a link. */
|
||||||
|
if((*link_length) < (int)name_size)
|
||||||
|
(*link_length) = name_size;
|
||||||
|
|
||||||
/* Now ask the file system to resolve the entire path. */
|
/* Now ask the file system to resolve the entire path. */
|
||||||
result = ReadLink(dvp->dvp_Port,dvp->dvp_Lock,(STRPTR)name,(STRPTR)name,name_size);
|
result = ReadLink(dvp->dvp_Port,dvp->dvp_Lock,(STRPTR)name,(STRPTR)name,name_size);
|
||||||
if(result < 0)
|
if(result < 0)
|
||||||
@ -194,7 +198,7 @@ lstat(const char * path_name, struct stat * st)
|
|||||||
int result = -1;
|
int result = -1;
|
||||||
LONG status;
|
LONG status;
|
||||||
BPTR file_lock = ZERO;
|
BPTR file_lock = ZERO;
|
||||||
int link_length = 0;
|
int link_length = -1;
|
||||||
|
|
||||||
ENTER();
|
ENTER();
|
||||||
|
|
||||||
@ -229,18 +233,13 @@ lstat(const char * path_name, struct stat * st)
|
|||||||
We make up some pseudo data for it. */
|
We make up some pseudo data for it. */
|
||||||
if(path_name_nti.is_root)
|
if(path_name_nti.is_root)
|
||||||
{
|
{
|
||||||
struct DateStamp ds;
|
|
||||||
time_t mtime;
|
time_t mtime;
|
||||||
|
|
||||||
SHOWMSG("setting up the root directory info");
|
SHOWMSG("setting up the root directory info");
|
||||||
|
|
||||||
memset(st,0,sizeof(*st));
|
memset(st,0,sizeof(*st));
|
||||||
|
|
||||||
PROFILE_OFF();
|
time(&mtime);
|
||||||
DateStamp(&ds);
|
|
||||||
PROFILE_ON();
|
|
||||||
|
|
||||||
mtime = __convert_datestamp_to_time(&ds);
|
|
||||||
|
|
||||||
st->st_mode = S_IFDIR | S_IRUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH;
|
st->st_mode = S_IFDIR | S_IRUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH;
|
||||||
st->st_mtime = mtime;
|
st->st_mtime = mtime;
|
||||||
@ -263,7 +262,7 @@ lstat(const char * path_name, struct stat * st)
|
|||||||
file_lock = lstat_lock(path_name,SHARED_LOCK,&link_length);
|
file_lock = lstat_lock(path_name,SHARED_LOCK,&link_length);
|
||||||
PROFILE_ON();
|
PROFILE_ON();
|
||||||
|
|
||||||
if(file_lock == ZERO)
|
if(file_lock == ZERO && link_length < 0)
|
||||||
{
|
{
|
||||||
SHOWMSG("that didn't work");
|
SHOWMSG("that didn't work");
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user