dlogutil: fix a potential deadlock 55/198455/1
authorMichal Bloch <m.bloch@samsung.com>
Thu, 24 Jan 2019 15:00:17 +0000 (16:00 +0100)
committerMichal Bloch <m.bloch@samsung.com>
Thu, 24 Jan 2019 15:00:17 +0000 (16:00 +0100)
Change-Id: Iff6961991c833f7ab4664fc3ac44859bd2e69cd1
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
src/logutil/fdi_pipe.c

index 9a39779..5fbf001 100644 (file)
@@ -211,10 +211,9 @@ static int pipe_read(struct fd_info *fdi)
        if (ppd->data_len == sizeof ppd->buff)
                return -EAGAIN;
 
-       if (ppd->offset > 0 && ppd->data_len > 0) {
+       if (ppd->offset > 0 && ppd->data_len > 0)
                memmove(ppd->buff, ppd->buff + ppd->offset, ppd->data_len);
-               ppd->offset = 0;
-       }
+       ppd->offset = 0;
 
        int r = read(fdi->fd, ppd->buff + ppd->offset + ppd->data_len, RECEIVE_BUFFER_SIZE - ppd->data_len - ppd->offset);
        if (r < 0)