summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2006-06-10 19:29:23 +0000
committerSebastien Helleu <flashcode@flashtux.org>2006-06-10 19:29:23 +0000
commit08aa5570d87b6a971933e1a85f5277543a1e0786 (patch)
tree1781e4ae889c65ae8e7f21f53f89894325d4641b /src
parent62059cb614d69f340655560cffb10f56b17b3a9a (diff)
downloadweechat-08aa5570d87b6a971933e1a85f5277543a1e0786.zip
Added error message when home is not a directory (bug #16772)
Diffstat (limited to 'src')
-rw-r--r--src/common/weechat.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/common/weechat.c b/src/common/weechat.c
index 933d4ef04..76d426aa0 100644
--- a/src/common/weechat.c
+++ b/src/common/weechat.c
@@ -693,6 +693,7 @@ weechat_create_home_dirs ()
{
char *ptr_home;
int dir_length;
+ struct stat statinfo;
if (!weechat_home)
{
@@ -715,6 +716,17 @@ weechat_create_home_dirs ()
snprintf (weechat_home, dir_length, "%s%s.weechat", ptr_home,
DIR_SEPARATOR);
}
+
+ /* if home already exists, it has to be a directory */
+ if (stat (weechat_home, &statinfo) == 0)
+ {
+ if (!S_ISDIR (statinfo.st_mode))
+ {
+ fprintf (stderr, _("%s home (%s) is not a directory\n"),
+ WEECHAT_ERROR, weechat_home);
+ weechat_shutdown (EXIT_FAILURE, 0);
+ }
+ }
/* create home directory; error is fatal */
if (!weechat_create_dir (weechat_home))