1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-12-04 14:46:47 -05:00

Use mode_t and mode macros everywhere.

This commit is contained in:
Laurent MONIN 2006-01-10 23:35:22 +01:00 committed by Laurent MONIN
parent 6966d15d67
commit 9b88da873a
10 changed files with 17 additions and 17 deletions

View File

@ -321,7 +321,7 @@ save_input_history(struct input_history *history, unsigned char *filename)
history_file = straconcat(elinks_home, filename, NULL);
if (!history_file) return -1;
ssi = secure_open(history_file, 0177);
ssi = secure_open(history_file, S_IXUSR | S_IRWXG | S_IRWXO);
mem_free(history_file);
if (!ssi) return -1;

View File

@ -94,7 +94,7 @@ bookmarks_write(struct list_head *bookmarks_list)
file_name = straconcat(elinks_home, file_name, NULL);
if (!file_name) return;
ssi = secure_open(file_name, 0177);
ssi = secure_open(file_name, S_IXUSR | S_IRWXG | S_IRWXO);
mem_free(file_name);
if (!ssi) return;

View File

@ -805,7 +805,7 @@ write_config_file(unsigned char *prefix, unsigned char *name,
config_file = straconcat(prefix, slash, name, NULL);
if (!config_file) goto free_cfg_str;
ssi = secure_open(config_file, 0177);
ssi = secure_open(config_file, S_IXUSR | S_IRWXG | S_IRWXO);
if (ssi) {
secure_fputs(ssi, cfg_str);
ret = secure_close(ssi);

View File

@ -775,7 +775,7 @@ save_cookies(void) {
cookfile = straconcat(elinks_home, COOKIES_FILENAME, NULL);
if (!cookfile) return;
ssi = secure_open(cookfile, 0177); /* rw for user only */
ssi = secure_open(cookfile, S_IXUSR | S_IRWXG | S_IRWXO);
mem_free(cookfile);
if (!ssi) return;

View File

@ -225,7 +225,7 @@ save_formhist_to_file(void)
file = straconcat(elinks_home, FORMS_HISTORY_FILENAME, NULL);
if (!file) return 0;
ssi = secure_open(file, 0177);
ssi = secure_open(file, S_IXUSR | S_IRWXG | S_IRWXO);
mem_free(file);
if (!ssi) return 0;

View File

@ -369,7 +369,7 @@ write_global_history(void)
file_name = straconcat(elinks_home, GLOBAL_HISTORY_FILENAME, NULL);
if (!file_name) return;
ssi = secure_open(file_name, 0177); /* rw for user only */
ssi = secure_open(file_name, S_IXUSR | S_IRWXG | S_IRWXO);
mem_free(file_name);
if (!ssi) return;

View File

@ -371,7 +371,7 @@ elinks_usleep(unsigned long useconds)
static int
bind_to_af_unix(void)
{
mode_t saved_mask = umask(0177);
mode_t saved_mask = umask(S_IXUSR | S_IRWXG | S_IRWXO);
int attempts = 0;
int pf = get_address(&s_info_listen, ADDR_IP_SERVER);

View File

@ -138,7 +138,7 @@ enum ftp_unix {
static int
parse_ftp_unix_permissions(const unsigned char *src, int len)
{
int perms = 0;
mode_t perms = 0;
if (len != 9
&& !(len == 10 && src[9] == '+')) /* ACL tag */
@ -583,12 +583,12 @@ parse_ftp_winnt_response(struct ftp_file_info *info, unsigned char *src, int len
if (*src == '<') {
info->type = FTP_FILE_DIRECTORY;
info->permissions = 0755;
info->permissions = S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH;
} else if (isdigit(*src)) {
info->type = FTP_FILE_PLAINFILE;
info->size = parse_ftp_number(&src, end, 0, LONG_MAX);
info->permissions = 0644;
info->permissions = S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH;
} else {
info->type = FTP_FILE_UNKNOWN;

View File

@ -22,7 +22,7 @@ struct ftp_file_info {
long size; /* File size. -1 if unknown. */
time_t mtime; /* Modification time */
unsigned int local_time_zone:1; /* What format the mtime is in */
int permissions; /* File permissions */
mode_t permissions; /* File permissions */
};
#define FTP_SIZE_UNKNOWN -1
@ -30,10 +30,10 @@ struct ftp_file_info {
/* File info initializers: */
#define INIT_FTP_FILE_INFO \
{ FTP_FILE_UNKNOWN, INIT_STRING("", 0), INIT_STRING("", 0), FTP_SIZE_UNKNOWN, 0, 0, 0644 }
{ FTP_FILE_UNKNOWN, INIT_STRING("", 0), INIT_STRING("", 0), FTP_SIZE_UNKNOWN, 0, 0, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH }
#define INIT_FTP_FILE_INFO_ROOT \
{ FTP_FILE_DIRECTORY, INIT_STRING("..", 2), INIT_STRING("", 0), FTP_SIZE_UNKNOWN, 0, 0, 0755 }
{ FTP_FILE_DIRECTORY, INIT_STRING("..", 2), INIT_STRING("", 0), FTP_SIZE_UNKNOWN, 0, 0, S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH }
struct ftp_file_info *
parse_ftp_file_info(struct ftp_file_info *info, unsigned char *src, int len);

View File

@ -272,7 +272,7 @@ file_read_line(unsigned char *line, size_t *size, FILE *file, int *lineno)
int
safe_mkstemp(unsigned char *template)
{
mode_t saved_mask = umask(0177);
mode_t saved_mask = umask(S_IXUSR | S_IRWXG | S_IRWXO);
int fd = mkstemp(template);
umask(saved_mask);
@ -321,12 +321,12 @@ stat_mode(struct string *string, struct stat *stp)
unsigned char rwx[10] = "---------";
if (stp) {
int mode = stp->st_mode;
int shift;
mode_t mode = stp->st_mode;
unsigned int shift;
/* Set permissions attributes for user, group and other */
for (shift = 0; shift <= 6; shift += 3) {
int m = mode << shift;
mode_t m = mode << shift;
if (m & S_IRUSR) rwx[shift + 0] = 'r';
if (m & S_IWUSR) rwx[shift + 1] = 'w';