From 151bcbd3a2d1247e6621a7d45538dbd0f576870f Mon Sep 17 00:00:00 2001 From: Laurent MONIN Date: Tue, 10 Jan 2006 23:40:39 +0100 Subject: [PATCH] Prefer S_I?USR and S_IRWXU over obsolete S_IREAD, S_IWRITE, S_IEXEC. --- src/protocol/bittorrent/piececache.c | 4 ++-- src/protocol/file/cgi.c | 2 +- src/util/file.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/protocol/bittorrent/piececache.c b/src/protocol/bittorrent/piececache.c index a1aca7309..b6ef4a6e3 100644 --- a/src/protocol/bittorrent/piececache.c +++ b/src/protocol/bittorrent/piececache.c @@ -657,14 +657,14 @@ open_bittorrent_file(struct bittorrent_meta *meta, struct bittorrent_file *file, if (!name) return -1; - fd = open(name, flags, S_IREAD | S_IWRITE); + fd = open(name, flags, S_IRUSR | S_IWUSR); if (fd == -1) { /* 99% of the time the file will already exist so special case * the directory and file creation. */ if (errno == ENOENT && trans == BITTORRENT_WRITE && create_bittorrent_path(name) == BITTORRENT_STATE_OK) - fd = open(name, flags | O_CREAT, S_IREAD | S_IWRITE); + fd = open(name, flags | O_CREAT, S_IRUSR | S_IWUSR); } mem_free(name); diff --git a/src/protocol/file/cgi.c b/src/protocol/file/cgi.c index 74e3c9b8b..67d8744af 100644 --- a/src/protocol/file/cgi.c +++ b/src/protocol/file/cgi.c @@ -299,7 +299,7 @@ execute_cgi(struct connection *conn) scriptlen = strlen(script); if (stat(script, &buf) || !(S_ISREG(buf.st_mode)) - || !(buf.st_mode & S_IEXEC)) { + || !(buf.st_mode & S_IXUSR)) { mem_free(script); return 1; } diff --git a/src/util/file.c b/src/util/file.c index e0b186500..feaadc2ad 100644 --- a/src/util/file.c +++ b/src/util/file.c @@ -607,7 +607,7 @@ mkalldirs(const unsigned char *path) p[pos] = 0; - ret = mkdir(p, S_IREAD | S_IWRITE | S_IEXEC); + ret = mkdir(p, S_IRWXU); p[pos] = separator;