2011-04-13 04:01 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)

* contrib/hbunix/chroot.c
    ! following suit with the others functions, on error, errno should be
      saved.
    + further, in about 101% of the cases, chroot() is to be followed by a
      chdir("/"), so i think it would be right to include this right here.
    ; [Tamas Tevesz]
This commit is contained in:
Viktor Szakats
2011-04-13 02:01:50 +00:00
parent 0f8e3b5791
commit 89ff899810
2 changed files with 20 additions and 1 deletions

View File

@@ -16,6 +16,14 @@
The license applies to all entries newer than 2009-04-28.
*/
2011-04-13 04:01 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
* contrib/hbunix/chroot.c
! following suit with the others functions, on error, errno should be
saved.
+ further, in about 101% of the cases, chroot() is to be followed by a
chdir("/"), so i think it would be right to include this right here.
; [Tamas Tevesz]
2011-04-13 02:09 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
+ contrib/hbunix/chroot.c
* contrib/hbunix/hbunix.hbp

View File

@@ -54,5 +54,16 @@
HB_FUNC( UNIX_CHROOT )
{
hb_retni( chroot( hb_parcx( 1 ) ) );
if( chroot( hb_parcx( 1 ) ) == -1 )
{
hb_posix_save_errno();
hb_retni( -1 );
}
else if( chdir( "/" ) == -1 )
{
hb_posix_save_errno();
hb_retni( -1 );
}
else
hb_retni( 0 );
}