aboutsummaryrefslogtreecommitdiff
path: root/runit/runit_lib.c
diff options
context:
space:
mode:
Diffstat (limited to 'runit/runit_lib.c')
-rw-r--r--runit/runit_lib.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/runit/runit_lib.c b/runit/runit_lib.c
index ec18b5edd..8182a909a 100644
--- a/runit/runit_lib.c
+++ b/runit/runit_lib.c
@@ -198,27 +198,29 @@ void iopause(iopause_fd *x, unsigned len, struct taia *deadline, struct taia *st
198 198
199int lock_ex(int fd) 199int lock_ex(int fd)
200{ 200{
201 return flock(fd,LOCK_EX); 201 return flock(fd, LOCK_EX);
202} 202}
203 203
204int lock_exnb(int fd) 204int lock_exnb(int fd)
205{ 205{
206 return flock(fd,LOCK_EX | LOCK_NB); 206 return flock(fd, LOCK_EX | LOCK_NB);
207} 207}
208 208
209#ifdef UNUSED
209int open_append(const char *fn) 210int open_append(const char *fn)
210{ 211{
211 return open(fn, O_WRONLY|O_NDELAY|O_APPEND|O_CREAT, 0600); 212 return open(fn, O_WRONLY | O_NDELAY | O_APPEND | O_CREAT, 0600);
212} 213}
213 214
214int open_read(const char *fn) 215int open_trunc(const char *fn)
215{ 216{
216 return open(fn, O_RDONLY|O_NDELAY); 217 return open(fn, O_WRONLY | O_NDELAY | O_TRUNC | O_CREAT, 0644);
217} 218}
219#endif
218 220
219int open_trunc(const char *fn) 221int open_read(const char *fn)
220{ 222{
221 return open(fn,O_WRONLY | O_NDELAY | O_TRUNC | O_CREAT,0644); 223 return open(fn, O_RDONLY|O_NDELAY);
222} 224}
223 225
224int open_write(const char *fn) 226int open_write(const char *fn)
@@ -226,7 +228,7 @@ int open_write(const char *fn)
226 return open(fn, O_WRONLY|O_NDELAY); 228 return open(fn, O_WRONLY|O_NDELAY);
227} 229}
228 230
229unsigned pmatch(const char *p, const char *s, unsigned len) 231unsigned FAST_FUNC pmatch(const char *p, const char *s, unsigned len)
230{ 232{
231 for (;;) { 233 for (;;) {
232 char c = *p++; 234 char c = *p++;