mirror of
https://github.com/amadvance/snapraid.git
synced 2026-11-25 09:26:27 -05:00
Use eaccess() instead of access()
This commit is contained in:
parent
1f0136f2e5
commit
81995ccc8d
5 changed files with 54 additions and 36 deletions
|
|
@ -593,38 +593,6 @@ void log_close(const char* file)
|
|||
stdlog = 0;
|
||||
}
|
||||
|
||||
/****************************************************************************/
|
||||
/* config */
|
||||
|
||||
void config(char* conf, size_t conf_size, const char* argv0)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
char* slash;
|
||||
|
||||
pathimport(conf, conf_size, argv0);
|
||||
|
||||
slash = strrchr(conf, '/');
|
||||
if (slash) {
|
||||
slash[1] = 0;
|
||||
pathcat(conf, conf_size, PACKAGE ".conf");
|
||||
} else {
|
||||
pathcpy(conf, conf_size, PACKAGE ".conf");
|
||||
}
|
||||
#else
|
||||
(void)argv0;
|
||||
|
||||
#ifdef SYSCONFDIR
|
||||
/* if it exists, give precedence at sysconfdir, usually /usr/local/etc */
|
||||
if (access(SYSCONFDIR "/" PACKAGE ".conf", F_OK) == 0) {
|
||||
pathcpy(conf, conf_size, SYSCONFDIR "/" PACKAGE ".conf");
|
||||
} else /* otherwise fallback to plain /etc */
|
||||
#endif
|
||||
{
|
||||
pathcpy(conf, conf_size, "/etc/" PACKAGE ".conf");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/****************************************************************************/
|
||||
/* main */
|
||||
|
||||
|
|
@ -1008,7 +976,7 @@ int snapraid_main(int argc, char* argv[])
|
|||
lock_init();
|
||||
|
||||
/* defaults */
|
||||
config(conf, sizeof(conf), argv[0]);
|
||||
os_default_conf(conf, sizeof(conf), argv[0]);
|
||||
memset(&opt, 0, sizeof(opt));
|
||||
opt.io_error_limit = 100;
|
||||
blockstart = 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue