From: Alan Cox Date: Thu, 22 Sep 2016 21:50:20 +0000 (+0100) Subject: open: fix truncating on read only open X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=98d272cd0d3a2445142d2f14ef7d95352fa91035;p=FUZIX.git open: fix truncating on read only open Also note another point where we need to fix up refcount handling for FIFO nodes --- diff --git a/Kernel/syscall_fs3.c b/Kernel/syscall_fs3.c index 634c9c66..17725a67 100644 --- a/Kernel/syscall_fs3.c +++ b/Kernel/syscall_fs3.c @@ -113,7 +113,7 @@ arg_t _open(void) ino = *iptr; } - if (trunc && getmode(ino) == MODE_R(F_REG)) { + if (w && trunc && getmode(ino) == MODE_R(F_REG)) { if (f_trunc(ino)) goto idrop; for (j = 0; j < OFTSIZE; ++j) @@ -136,7 +136,8 @@ arg_t _open(void) /* FIXME: ATIME ? */ /* - * Sleep process if no writer or reader + * Sleep process if no writer or reader. + * FIXME: check for other of pair now we have proper counts */ if (getmode(ino) == MODE_R(F_PIPE) && of_tab[oftindex].o_refs == 1 && !(flag & O_NDELAY))