(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:
parent
5282f500b5
commit
376d87c3a0
2 changed files with 2 additions and 11 deletions
|
@ -60,15 +60,6 @@ typedef long ssize_t;
|
|||
|
||||
#define strncasecmp(s1, s2, s3) _strnicmp(s1, s2, s3)
|
||||
#define mkdir(dir,perm) _mkdir((dir))
|
||||
#ifndef F_OK
|
||||
#define F_OK 0 /* FILE existence */
|
||||
#endif
|
||||
#ifndef W_OK
|
||||
#define W_OK 02 /* Write permission */
|
||||
#endif
|
||||
#ifndef R_OK
|
||||
#define R_OK 04 /* Read permission */
|
||||
#endif
|
||||
|
||||
typedef int pid_t;
|
||||
#define vsnprintf _vsnprintf
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue