aboutsummaryrefslogtreecommitdiffstats
path: root/unix/vncpasswd/vncpasswd.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'unix/vncpasswd/vncpasswd.cxx')
-rw-r--r--unix/vncpasswd/vncpasswd.cxx19
1 files changed, 14 insertions, 5 deletions
diff --git a/unix/vncpasswd/vncpasswd.cxx b/unix/vncpasswd/vncpasswd.cxx
index 93ad6f6f..68c44289 100644
--- a/unix/vncpasswd/vncpasswd.cxx
+++ b/unix/vncpasswd/vncpasswd.cxx
@@ -156,13 +156,22 @@ int main(int argc, char** argv)
}
if (fname[0] == '\0') {
- const char *homeDir = os::getvnchomedir();
- if (homeDir == NULL) {
- fprintf(stderr, "Can't obtain VNC home directory\n");
+ const char *configDir = os::getvncconfigdir();
+ if (configDir == NULL) {
+ fprintf(stderr, "Can't obtain VNC config directory\n");
exit(1);
}
- mkdir(homeDir, 0777);
- snprintf(fname, sizeof(fname), "%s/passwd", homeDir);
+ strcpy(fname, configDir);
+ char *p = NULL;
+ for (p = fname + 1; *p; p++) {
+ if (*p == '/') {
+ *p = '\0';
+ mkdir(fname, 0777);
+ *p = '/';
+ }
+ }
+ mkdir(fname, 0777);
+ snprintf(fname, sizeof(fname), "%s/passwd", configDir);
}
while (true) {