mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05:00
Prefer S_I?USR and S_IRWXU over obsolete S_IREAD, S_IWRITE, S_IEXEC.
This commit is contained in:
parent
88de36b8d2
commit
151bcbd3a2
@ -657,14 +657,14 @@ open_bittorrent_file(struct bittorrent_meta *meta, struct bittorrent_file *file,
|
|||||||
|
|
||||||
if (!name) return -1;
|
if (!name) return -1;
|
||||||
|
|
||||||
fd = open(name, flags, S_IREAD | S_IWRITE);
|
fd = open(name, flags, S_IRUSR | S_IWUSR);
|
||||||
if (fd == -1) {
|
if (fd == -1) {
|
||||||
/* 99% of the time the file will already exist so special case
|
/* 99% of the time the file will already exist so special case
|
||||||
* the directory and file creation. */
|
* the directory and file creation. */
|
||||||
if (errno == ENOENT
|
if (errno == ENOENT
|
||||||
&& trans == BITTORRENT_WRITE
|
&& trans == BITTORRENT_WRITE
|
||||||
&& create_bittorrent_path(name) == BITTORRENT_STATE_OK)
|
&& 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);
|
mem_free(name);
|
||||||
|
@ -299,7 +299,7 @@ execute_cgi(struct connection *conn)
|
|||||||
scriptlen = strlen(script);
|
scriptlen = strlen(script);
|
||||||
|
|
||||||
if (stat(script, &buf) || !(S_ISREG(buf.st_mode))
|
if (stat(script, &buf) || !(S_ISREG(buf.st_mode))
|
||||||
|| !(buf.st_mode & S_IEXEC)) {
|
|| !(buf.st_mode & S_IXUSR)) {
|
||||||
mem_free(script);
|
mem_free(script);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -607,7 +607,7 @@ mkalldirs(const unsigned char *path)
|
|||||||
|
|
||||||
p[pos] = 0;
|
p[pos] = 0;
|
||||||
|
|
||||||
ret = mkdir(p, S_IREAD | S_IWRITE | S_IEXEC);
|
ret = mkdir(p, S_IRWXU);
|
||||||
|
|
||||||
p[pos] = separator;
|
p[pos] = separator;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user