summaryrefslogtreecommitdiff
path: root/openbsd-compat/port-linux.c
diff options
context:
space:
mode:
Diffstat (limited to 'openbsd-compat/port-linux.c')
-rw-r--r--openbsd-compat/port-linux.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/openbsd-compat/port-linux.c b/openbsd-compat/port-linux.c
index bc4924727..b7142ba90 100644
--- a/openbsd-compat/port-linux.c
+++ b/openbsd-compat/port-linux.c
@@ -197,10 +197,10 @@ ssh_selinux_setup_pty(char *pwname, const char *tty)
197 197
198#ifdef OOM_ADJUST 198#ifdef OOM_ADJUST
199/* Get the out-of-memory adjustment file for the current process */ 199/* Get the out-of-memory adjustment file for the current process */
200int 200static int
201oom_adj_open(void) 201oom_adj_open(int oflag)
202{ 202{
203 int fd = open("/proc/self/oom_adj", O_RDWR); 203 int fd = open("/proc/self/oom_adj", oflag);
204 if (fd < 0) 204 if (fd < 0)
205 logit("error opening /proc/self/oom_adj: %s", strerror(errno)); 205 logit("error opening /proc/self/oom_adj: %s", strerror(errno));
206 return fd; 206 return fd;
@@ -211,7 +211,7 @@ int
211oom_adj_get(char *buf, size_t maxlen) 211oom_adj_get(char *buf, size_t maxlen)
212{ 212{
213 ssize_t n; 213 ssize_t n;
214 int fd = oom_adj_open(); 214 int fd = oom_adj_open(O_RDONLY);
215 if (fd < 0) 215 if (fd < 0)
216 return -1; 216 return -1;
217 n = read(fd, buf, maxlen); 217 n = read(fd, buf, maxlen);
@@ -228,7 +228,7 @@ int
228oom_adj_set(const char *buf) 228oom_adj_set(const char *buf)
229{ 229{
230 ssize_t n; 230 ssize_t n;
231 int fd = oom_adj_open(); 231 int fd = oom_adj_open(O_WRONLY);
232 if (fd < 0) 232 if (fd < 0)
233 return -1; 233 return -1;
234 n = write(fd, buf, strlen(buf)); 234 n = write(fd, buf, strlen(buf));