Ticket #7859: 0001-fifo-fix-7859.patch

File 0001-fifo-fix-7859.patch, 1.9 KB (added by phoudoin, 7 years ago)
  • src/system/kernel/fs/fifo.cpp

    From ee0274907014da44773c7646bb768252fb27e195 Mon Sep 17 00:00:00 2001
    From: Philippe Houdoin <philippe.houdoin@gmail.com>
    Date: Wed, 26 Jul 2017 18:15:11 +0000
    Subject: [PATCH] fifo: fix #7859
    
    ---
     src/system/kernel/fs/fifo.cpp | 17 ++++++++---------
     1 file changed, 8 insertions(+), 9 deletions(-)
    
    diff --git a/src/system/kernel/fs/fifo.cpp b/src/system/kernel/fs/fifo.cpp
    index e7e9f2c2e1..65c1b0203f 100644
    a b Inode::NotifyEndClosed(bool writer)  
    615615                request->Notify();
    616616
    617617            if (fReadSelectSyncPool)
    618                 notify_select_event_pool(fReadSelectSyncPool, B_SELECT_READ);
     618                notify_select_event_pool(fReadSelectSyncPool, B_SELECT_DISCONNECTED);
    619619        }
    620620    } else {
    621621        // Last reader is gone. Wake up all writers.
    Inode::NotifyEndClosed(bool writer)  
    623623
    624624        if (fWriteSelectSyncPool) {
    625625            notify_select_event_pool(fWriteSelectSyncPool, B_SELECT_WRITE);
    626             notify_select_event_pool(fWriteSelectSyncPool, B_SELECT_ERROR);
     626            notify_select_event_pool(fWriteSelectSyncPool, B_SELECT_DISCONNECTED);
    627627        }
    628628    }
    629629}
    Inode::Select(uint8 event, selectsync* sync, int openMode)  
    710710
    711711    // signal right away, if the condition holds already
    712712    if (writer) {
    713         if ((event == B_SELECT_WRITE
    714                 && (fBuffer.Writable() > 0 || fReaderCount == 0))
    715             || (event == B_SELECT_ERROR && fReaderCount == 0)) {
     713        if (event == B_SELECT_WRITE && fBuffer.Writable() > 0)
    716714            return notify_select_event(sync, event);
    717         }
     715        if (fReaderCount == 0)
     716            return notify_select_event(sync, B_SELECT_DISCONNECTED);
    718717    } else {
    719         if (event == B_SELECT_READ
    720                 && (fBuffer.Readable() > 0 || fWriterCount == 0)) {
     718        if (event == B_SELECT_READ && fBuffer.Readable() > 0)
    721719            return notify_select_event(sync, event);
    722         }
     720        if (fWriterCount == 0)
     721            return notify_select_event(sync, B_SELECT_DISCONNECTED);
    723722    }
    724723
    725724    return B_OK;