summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--opentracker.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/opentracker.c b/opentracker.c
index 57eca12..d0ab047 100644
--- a/opentracker.c
+++ b/opentracker.c
@@ -482,7 +482,7 @@ int drop_privileges (const char * const serverdir) {
482 482
483 if( geteuid() == 0 ) { 483 if( geteuid() == 0 ) {
484 /* Running as root: chroot and drop privileges */ 484 /* Running as root: chroot and drop privileges */
485 if(chroot( serverdir )) { 485 if( serverdir && chroot( serverdir ) ) {
486 fprintf( stderr, "Could not chroot to %s, because: %s\n", serverdir, strerror(errno) ); 486 fprintf( stderr, "Could not chroot to %s, because: %s\n", serverdir, strerror(errno) );
487 return -1; 487 return -1;
488 } 488 }
@@ -504,7 +504,7 @@ int drop_privileges (const char * const serverdir) {
504 } 504 }
505 else { 505 else {
506 /* Normal user, just chdir() */ 506 /* Normal user, just chdir() */
507 if(chdir( serverdir )) { 507 if( serverdir && chdir( serverdir ) ) {
508 fprintf( stderr, "Could not chroot to %s, because: %s\n", serverdir, strerror(errno) ); 508 fprintf( stderr, "Could not chroot to %s, because: %s\n", serverdir, strerror(errno) );
509 return -1; 509 return -1;
510 } 510 }
@@ -578,7 +578,7 @@ int main( int argc, char **argv ) {
578 ot_try_bind( serverip, 6969, FLAG_UDP ); 578 ot_try_bind( serverip, 6969, FLAG_UDP );
579 } 579 }
580 580
581 if( drop_privileges( g_serverdir ? g_serverdir : "." ) == -1 ) 581 if( drop_privileges( g_serverdir ) == -1 )
582 panic( "drop_privileges failed, exiting. Last error"); 582 panic( "drop_privileges failed, exiting. Last error");
583 583
584 g_now_seconds = time( NULL ); 584 g_now_seconds = time( NULL );