diff options
-rw-r--r-- | ChangeLog | 3 | ||||
-rw-r--r-- | src/common/weechat.c | 25 | ||||
-rw-r--r-- | weechat/ChangeLog | 3 | ||||
-rw-r--r-- | weechat/src/common/weechat.c | 25 |
4 files changed, 18 insertions, 38 deletions
@@ -1,10 +1,11 @@ WeeChat - Wee Enhanced Environment for Chat =========================================== -ChangeLog - 2007-02-05 +ChangeLog - 2007-02-06 Version 0.2.4 (under dev!): + * fixed permissions on "dcc" and "logs" directories (bug #18978) * added event handler to plugin API * added scots quickstart guide * added numeric argument for /clear command (buffer number) (patch #5372) diff --git a/src/common/weechat.c b/src/common/weechat.c index 4d7754766..3df0d197f 100644 --- a/src/common/weechat.c +++ b/src/common/weechat.c @@ -445,7 +445,7 @@ weechat_parse_args (int argc, char *argv[]) */ int -weechat_create_dir (char *directory) +weechat_create_dir (char *directory, int permissions) { if (mkdir (directory, 0755) < 0) { @@ -456,7 +456,10 @@ weechat_create_dir (char *directory) WEECHAT_ERROR, directory); return 0; } + return 1; } + if ((permissions != 0) && (strcmp (directory, getenv ("HOME")) != 0)) + chmod (directory, permissions); return 1; } @@ -505,7 +508,7 @@ weechat_create_home_dirs () } /* create home directory; error is fatal */ - if (!weechat_create_dir (weechat_home)) + if (!weechat_create_dir (weechat_home, 0)) { weechat_iconv_fprintf (stderr, _("%s unable to create \"%s\" directory\n"), WEECHAT_ERROR, weechat_home); @@ -525,14 +528,7 @@ weechat_create_config_dirs () /* create logs directory" */ dir1 = weechat_strreplace (cfg_log_path, "~", getenv ("HOME")); dir2 = weechat_strreplace (dir1, "%h", weechat_home); - if (weechat_create_dir (dir2)) - { - if (strcmp (dir2, getenv ("HOME")) != 0) - chmod (dir2, 0700); - } - else - weechat_iconv_fprintf (stderr, _("%s unable to create \"%s\" directory\n"), - WEECHAT_WARNING, dir2); + (void) weechat_create_dir (dir2, 0700); if (dir1) free (dir1); if (dir2) @@ -541,14 +537,7 @@ weechat_create_config_dirs () /* create DCC download directory */ dir1 = weechat_strreplace (cfg_dcc_download_path, "~", getenv ("HOME")); dir2 = weechat_strreplace (dir1, "%h", weechat_home); - if (weechat_create_dir (dir2)) - { - if (strcmp (dir2, getenv ("HOME")) != 0) - chmod (dir2, 0700); - } - else - weechat_iconv_fprintf (stderr, _("%s unable to create \"%s\" directory\n"), - WEECHAT_WARNING, dir2); + (void) weechat_create_dir (dir2, 0700); if (dir1) free (dir1); if (dir2) diff --git a/weechat/ChangeLog b/weechat/ChangeLog index 143ca51af..da6d7f0a3 100644 --- a/weechat/ChangeLog +++ b/weechat/ChangeLog @@ -1,10 +1,11 @@ WeeChat - Wee Enhanced Environment for Chat =========================================== -ChangeLog - 2007-02-05 +ChangeLog - 2007-02-06 Version 0.2.4 (under dev!): + * fixed permissions on "dcc" and "logs" directories (bug #18978) * added event handler to plugin API * added scots quickstart guide * added numeric argument for /clear command (buffer number) (patch #5372) diff --git a/weechat/src/common/weechat.c b/weechat/src/common/weechat.c index 4d7754766..3df0d197f 100644 --- a/weechat/src/common/weechat.c +++ b/weechat/src/common/weechat.c @@ -445,7 +445,7 @@ weechat_parse_args (int argc, char *argv[]) */ int -weechat_create_dir (char *directory) +weechat_create_dir (char *directory, int permissions) { if (mkdir (directory, 0755) < 0) { @@ -456,7 +456,10 @@ weechat_create_dir (char *directory) WEECHAT_ERROR, directory); return 0; } + return 1; } + if ((permissions != 0) && (strcmp (directory, getenv ("HOME")) != 0)) + chmod (directory, permissions); return 1; } @@ -505,7 +508,7 @@ weechat_create_home_dirs () } /* create home directory; error is fatal */ - if (!weechat_create_dir (weechat_home)) + if (!weechat_create_dir (weechat_home, 0)) { weechat_iconv_fprintf (stderr, _("%s unable to create \"%s\" directory\n"), WEECHAT_ERROR, weechat_home); @@ -525,14 +528,7 @@ weechat_create_config_dirs () /* create logs directory" */ dir1 = weechat_strreplace (cfg_log_path, "~", getenv ("HOME")); dir2 = weechat_strreplace (dir1, "%h", weechat_home); - if (weechat_create_dir (dir2)) - { - if (strcmp (dir2, getenv ("HOME")) != 0) - chmod (dir2, 0700); - } - else - weechat_iconv_fprintf (stderr, _("%s unable to create \"%s\" directory\n"), - WEECHAT_WARNING, dir2); + (void) weechat_create_dir (dir2, 0700); if (dir1) free (dir1); if (dir2) @@ -541,14 +537,7 @@ weechat_create_config_dirs () /* create DCC download directory */ dir1 = weechat_strreplace (cfg_dcc_download_path, "~", getenv ("HOME")); dir2 = weechat_strreplace (dir1, "%h", weechat_home); - if (weechat_create_dir (dir2)) - { - if (strcmp (dir2, getenv ("HOME")) != 0) - chmod (dir2, 0700); - } - else - weechat_iconv_fprintf (stderr, _("%s unable to create \"%s\" directory\n"), - WEECHAT_WARNING, dir2); + (void) weechat_create_dir (dir2, 0700); if (dir1) free (dir1); if (dir2) |