diff --git a/unix/vncserver b/unix/vncserver index 2000a39..e84a90f 100755 --- a/unix/vncserver +++ b/unix/vncserver @@ -129,14 +129,7 @@ if (! $skipxstartup) { &CreateXstartupIfNeeded(); } -# Create the user's config file if necessary. -if (!(-e "$vncUserDir/config")) { - warn "Creating default config $vncUserDir/config\n"; - open(VNCUSERCONFIG, ">$vncUserDir/config"); - print VNCUSERCONFIG $defaultConfig; - close(VNCUSERCONFIG); - chmod 0644, "$vncUserDir/config"; -} +&CreateUserConfigIfNeeded(); # Run the X startup script. if (! $skipxstartup) { @@ -958,3 +951,15 @@ sub WaitForXvncToStart { sub UsingSafeFontPath { $fontPath eq $defFontPath } + +sub CreateUserConfigIfNeeded { + if (-e "$vncUserDir/config") { + return; + } + + warn "Creating default config $vncUserDir/config\n"; + open(VNCUSERCONFIG, ">$vncUserDir/config"); + print VNCUSERCONFIG $defaultConfig; + close(VNCUSERCONFIG); + chmod 0644, "$vncUserDir/config"; +}