mirror of
https://github.com/weechat/weechat.git
synced 2026-07-04 00:33:13 +02:00
Added error message when home is not a directory (bug #16772)
This commit is contained in:
+205
-200
File diff suppressed because it is too large
Load Diff
@@ -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))
|
||||
|
||||
+205
-200
File diff suppressed because it is too large
Load Diff
+205
-200
File diff suppressed because it is too large
Load Diff
+205
-200
File diff suppressed because it is too large
Load Diff
+206
-201
File diff suppressed because it is too large
Load Diff
+205
-200
File diff suppressed because it is too large
Load Diff
+205
-200
File diff suppressed because it is too large
Load Diff
+205
-200
File diff suppressed because it is too large
Load Diff
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user