aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/bus.c12
-rw-r--r--src/cmdline.c10
2 files changed, 11 insertions, 11 deletions
diff --git a/src/bus.c b/src/bus.c
index 3205e25..4b6b8d1 100644
--- a/src/bus.c
+++ b/src/bus.c
@@ -1170,11 +1170,11 @@ bus_chmod(const char *file, mode_t mode)
struct shmid_ds shm_stat;
int shm_id;
- mode = (mode & S_IRWXU) ? (mode | S_IRWXU) : (mode & ~S_IRWXU);
- mode = (mode & S_IRWXG) ? (mode | S_IRWXG) : (mode & ~S_IRWXG);
- mode = (mode & S_IRWXO) ? (mode | S_IRWXO) : (mode & ~S_IRWXO);
+ mode = (mode & S_IRWXU) ? (mode | S_IRWXU) : (mode & (mode_t)~S_IRWXU);
+ mode = (mode & S_IRWXG) ? (mode | S_IRWXG) : (mode & (mode_t)~S_IRWXG);
+ mode = (mode & S_IRWXO) ? (mode | S_IRWXO) : (mode & (mode_t)~S_IRWXO);
mode &= (S_IWUSR | S_IWGRP | S_IWOTH | S_IRUSR | S_IRGRP | S_IROTH);
- fmode = mode & ~(S_IWGRP | S_IWOTH);
+ fmode = mode & (mode_t)~(S_IWGRP | S_IWOTH);
t(bus_open(&bus, file, -1));
t(chmod(file, fmode));
@@ -1182,13 +1182,13 @@ bus_chmod(const char *file, mode_t mode)
/* chmod sem */
t(open_semaphores(&bus));
t(semctl(bus.sem_id, 0, IPC_STAT, &sem_stat));
- sem_stat.sem_perm.mode = mode;
+ sem_stat.sem_perm.mode = (unsigned short)mode;
t(semctl(bus.sem_id, 0, IPC_SET, &sem_stat));
/* chmod shm */
t(shm_id = shmget(bus.key_shm, (size_t)BUS_MEMORY_SIZE, 0));
t(shmctl(shm_id, IPC_STAT, &shm_stat));
- shm_stat.shm_perm.mode = mode;
+ shm_stat.shm_perm.mode = (unsigned short)mode;
t(shmctl(shm_id, IPC_SET, &shm_stat));
return 0;
diff --git a/src/cmdline.c b/src/cmdline.c
index 97da729..25939cb 100644
--- a/src/cmdline.c
+++ b/src/cmdline.c
@@ -118,7 +118,7 @@ parse_mode(const char *str, mode_t *andnot, mode_t *or)
int numerical = 1;
mode_t mode = 0;
char op = '=';
- int bits;
+ mode_t bits;
*andnot = 0;
*or = 0;
@@ -139,9 +139,9 @@ parse_mode(const char *str, mode_t *andnot, mode_t *or)
*andnot = U | G | O;
*or = mode;
*or &= U | G | O;
- *or = (*or & U) ? (*or | U) : (*or & ~U);
- *or = (*or & G) ? (*or | G) : (*or & ~G);
- *or = (*or & O) ? (*or | O) : (*or & ~O);
+ *or = (*or & U) ? (*or | U) : (*or & (mode_t)~U);
+ *or = (*or & G) ? (*or | G) : (*or & (mode_t)~G);
+ *or = (*or & O) ? (*or | O) : (*or & (mode_t)~O);
return 0;
}
@@ -314,7 +314,7 @@ main(int argc, char *argv[])
mode_t mode_andnot, mode_or;
int opt_x = 0, opt_n = 0;
const char *arg;
- char **nonoptv = alloca(argc * sizeof(char*));
+ char **nonoptv = alloca((size_t)argc * sizeof(char*));
int nonoptc = 0;
argv0 = *argv++;