diff --git a/src/lib/core/popen.c b/src/lib/core/popen.c
index 01fb275bbfdb31afd0f39907abefbc2c82885580..3a12a439b04c99331814f0d1b1538d0431660620 100644
--- a/src/lib/core/popen.c
+++ b/src/lib/core/popen.c
@@ -370,7 +370,7 @@ stdX_str(unsigned int index)
  * FIXME: Provide an info re amount written bytes in the case.
  *        Say, return -(written) in the case.
  */
-int
+ssize_t
 popen_write_timeout(struct popen_handle *handle, const void *buf,
 		    size_t count, unsigned int flags,
 		    ev_tstamp timeout)
@@ -397,8 +397,8 @@ popen_write_timeout(struct popen_handle *handle, const void *buf,
 		  handle->pid, stdX_str(idx), idx, buf, count,
 		  handle->ios[idx].fd, timeout);
 
-	int rc = coio_write_timeout_noxc(&handle->ios[idx], buf, count,
-					 timeout);
+	ssize_t rc = coio_write_timeout_noxc(&handle->ios[idx], buf,
+					     count, timeout);
 	assert(rc < 0 || rc == (ssize_t)count);
 	return rc;
 }
diff --git a/src/lib/core/popen.h b/src/lib/core/popen.h
index cffb53933fa24837c92ec441188da7e972bf1ea0..4f4a6d99d6515bbec59804e1b3e9dce23e74bc81 100644
--- a/src/lib/core/popen.h
+++ b/src/lib/core/popen.h
@@ -167,7 +167,7 @@ popen_stat(struct popen_handle *handle, struct popen_stat *st);
 extern const char *
 popen_command(struct popen_handle *handle);
 
-extern int
+extern ssize_t
 popen_write_timeout(struct popen_handle *handle, const void *buf,
 		    size_t count, unsigned int flags,
 		    ev_tstamp timeout);