Pipes: Fix zero-lenth writes. From Jussi Kivilinna
This commit is contained in:
parent
ce0021e753
commit
0a939ff218
@ -384,6 +384,11 @@ ssize_t pipecommon_read(FAR struct file *filep, FAR char *buffer, size_t len)
|
|||||||
|
|
||||||
DEBUGASSERT(dev);
|
DEBUGASSERT(dev);
|
||||||
|
|
||||||
|
if (len == 0)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* Make sure that we have exclusive access to the device structure */
|
/* Make sure that we have exclusive access to the device structure */
|
||||||
|
|
||||||
if (sem_wait(&dev->d_bfsem) < 0)
|
if (sem_wait(&dev->d_bfsem) < 0)
|
||||||
@ -469,6 +474,11 @@ ssize_t pipecommon_write(FAR struct file *filep, FAR const char *buffer, size_t
|
|||||||
DEBUGASSERT(dev);
|
DEBUGASSERT(dev);
|
||||||
pipe_dumpbuffer("To PIPE:", (uint8_t*)buffer, len);
|
pipe_dumpbuffer("To PIPE:", (uint8_t*)buffer, len);
|
||||||
|
|
||||||
|
if (len == 0)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* At present, this method cannot be called from interrupt handlers. That is
|
/* At present, this method cannot be called from interrupt handlers. That is
|
||||||
* because it calls sem_wait (via pipecommon_semtake below) and sem_wait cannot
|
* because it calls sem_wait (via pipecommon_semtake below) and sem_wait cannot
|
||||||
* be called from interrupt level. This actually happens fairly commonly
|
* be called from interrupt level. This actually happens fairly commonly
|
||||||
|
Loading…
x
Reference in New Issue
Block a user