(main): Don't use access() before mkdir() to check whether the

directory to be created exists, just check errno afterwards.

[_WIN32] (F_OK, W_OK, R_OK): Unused, remove.
This commit is contained in:
Markus Armbruster 2006-02-18 09:29:49 +00:00
parent 5282f500b5
commit 376d87c3a0
2 changed files with 2 additions and 11 deletions

View file

@ -119,7 +119,7 @@ main(int argc, char *argv[])
ef_init();
if (access(gamedir, F_OK) < 0 && mkdir(gamedir, 0750) < 0) {
if (mkdir(gamedir, 0750) < 0 && errno != EEXIST) {
perror(gamedir);
printf("Can't make game directory\n");
exit(1);
@ -175,7 +175,7 @@ main(int argc, char *argv[])
putrealm(&realm);
}
}
if (access(teldir, F_OK) < 0 && mkdir(teldir, 0750) < 0) {
if (mkdir(teldir, 0750) < 0 && errno != EEXIST) {
perror(teldir);
printf("Can't make telegram directory\n");
exit(1);