MCOP first run now creates required directory instead of throwing error message

Patch kindly provided by Darrell Anderson


git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/dependencies/arts@1167610 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
v3.5.13-sru
tpearson 14 years ago
parent 3f4a52a7c4
commit 54c2399a7c

@ -47,10 +47,17 @@ static int check_tmp_dir(const char *tmp_dir)
int result; int result;
struct stat stat_buf; struct stat stat_buf;
result = lstat(tmp_dir, &stat_buf); result = lstat(tmp_dir, &stat_buf);
if ((result == -1) && (errno == ENOENT))
if ((result == -1) && (errno == ENOENT))
{ {
result = mkdir(tmp_dir, 0700);
if (result == -1)
{
arts_warning("Error: Cannot create directory \"%s\".\n", tmp_dir);
return 1; return 1;
} }
result = stat(tmp_dir, &stat_buf);
}
if ((result == -1) || (!S_ISDIR(stat_buf.st_mode))) if ((result == -1) || (!S_ISDIR(stat_buf.st_mode)))
{ {
arts_warning("Error: \"%s\" is not a directory.\n", tmp_dir); arts_warning("Error: \"%s\" is not a directory.\n", tmp_dir);

Loading…
Cancel
Save