summaryrefslogtreecommitdiff
path: root/pflocal/io.c
diff options
context:
space:
mode:
authorMiles Bader <miles@gnu.org>1995-09-05 18:24:00 +0000
committerMiles Bader <miles@gnu.org>1995-09-05 18:24:00 +0000
commit256e0d6c3339fe234d856e8445841b6152ffe028 (patch)
treec9dca1944dc361b225ddccd0f65bd0d4c50d336d /pflocal/io.c
parent57104cee31248c39b009e77773d59c7467a69804 (diff)
(S_io_stat): Only attempt to use the read pipe if it exists.
Diffstat (limited to 'pflocal/io.c')
-rw-r--r--pflocal/io.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/pflocal/io.c b/pflocal/io.c
index e8f3e2e2..b37ce7e2 100644
--- a/pflocal/io.c
+++ b/pflocal/io.c
@@ -283,17 +283,19 @@ S_io_stat (struct sock_user *user, struct stat *st)
/* As we try to be clever with large transfers, ask for them. */
st->st_blksize = vm_page_size * 16;
-debug (sock, "lock");
mutex_lock (&sock->lock); /* Make sure the pipes don't go away... */
rpipe = sock->read_pipe;
wpipe = sock->write_pipe;
- mutex_lock (&rpipe->lock);
- copy_time (&rpipe->read_time, &st->st_atime, &st->st_atime_usec);
- /* This seems useful. */
- st->st_size = pipe_readable (rpipe, 1);
- mutex_unlock (&rpipe->lock);
+ if (rpipe)
+ {
+ mutex_lock (&rpipe->lock);
+ copy_time (&rpipe->read_time, &st->st_atime, &st->st_atime_usec);
+ /* This seems useful. */
+ st->st_size = pipe_readable (rpipe, 1);
+ mutex_unlock (&rpipe->lock);
+ }
if (wpipe)
{
@@ -304,7 +306,6 @@ debug (sock, "lock");
copy_time (&sock->change_time, &st->st_ctime, &st->st_ctime_usec);
-debug (sock, "unlock");
mutex_unlock (&sock->lock);
return 0;