FIX EOF detection in PT_IO-based to_xfer_partial implementation.
[deliverable/binutils-gdb.git] / gdb / inf-ptrace.c
index 1ab6b0beee29074947af26bcc4c2880c16ba013a..1269d24b657430af712c77eddacf8ee51bb98e5b 100644 (file)
@@ -489,9 +489,9 @@ inf_ptrace_xfer_partial (struct target_ops *ops, enum target_object object,
        errno = 0;
        if (ptrace (PT_IO, pid, (caddr_t)&piod, 0) == 0)
          {
-           *xfered_len = piod.piod_len;
            /* Return the actual number of bytes read or written.  */
-           return TARGET_XFER_OK;
+           *xfered_len = piod.piod_len;
+           return (piod.piod_len == 0) ? TARGET_XFER_EOF : TARGET_XFER_OK;
          }
        /* If the PT_IO request is somehow not supported, fallback on
           using PT_WRITE_D/PT_READ_D.  Otherwise we will return zero
@@ -595,9 +595,9 @@ inf_ptrace_xfer_partial (struct target_ops *ops, enum target_object object,
        errno = 0;
        if (ptrace (PT_IO, pid, (caddr_t)&piod, 0) == 0)
          {
-           *xfered_len = piod.piod_len;
            /* Return the actual number of bytes read or written.  */
-           return TARGET_XFER_OK;
+           *xfered_len = piod.piod_len;
+           return (piod.piod_len == 0) ? TARGET_XFER_EOF : TARGET_XFER_OK;
          }
       }
 #endif
This page took 0.026761 seconds and 4 git commands to generate.