Commit fb6fcfb3 authored by Pontus Freyhult's avatar Pontus Freyhult

New function lsftp_path_is_absolute.

Rev: src/sftp/sftp_bind.c:1.10
parent 89a8868d
......@@ -1259,8 +1259,25 @@ lsftp_do_cd(const char *dir)
return 0;
}
int
lsftp_path_is_absolute( const char* path )
{
/* Return 0 if the path given is not absolute */
/* FIXME: Assumes the path is absolute iff it begins with / */
if( path &&
( path[0] == '/' )
)
return 1;
return 0;
}
const char *
lsftp_unqualify_path(const char *path )
lsftp_unqualify_path( const char *path )
{
/*
* Returns the part that was passed to lsftp_qualify_path
......@@ -1299,7 +1316,7 @@ lsftp_qualify_path(const char *path)
* side (no operation on absoulte paths, adds pwd/ to relative paths
*/
if( '/' == path[0] ||
if( lsftp_path_is_absolute( path ) ||
!curpath ||
!curpath[0]
)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment