aboutgitcodebugslistschat
path: root/lineread.h
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2024-06-06 20:09:48 +1000
committerStefano Brivio <sbrivio@redhat.com>2024-06-07 20:44:44 +0200
commitf9e8ee0777c257ffd2956a6dd51e866dff26bc8e (patch)
tree048a78b97301e3cac3e1d79bf4dff78bba351c33 /lineread.h
parentc919bbbdd370f86af37e18ca991c936d3bf36cfa (diff)
downloadpasst-f9e8ee0777c257ffd2956a6dd51e866dff26bc8e.tar
passt-f9e8ee0777c257ffd2956a6dd51e866dff26bc8e.tar.gz
passt-f9e8ee0777c257ffd2956a6dd51e866dff26bc8e.tar.bz2
passt-f9e8ee0777c257ffd2956a6dd51e866dff26bc8e.tar.lz
passt-f9e8ee0777c257ffd2956a6dd51e866dff26bc8e.tar.xz
passt-f9e8ee0777c257ffd2956a6dd51e866dff26bc8e.tar.zst
passt-f9e8ee0777c257ffd2956a6dd51e866dff26bc8e.zip
lineread: Use ssize_t for line lengths
Functions and structures in lineread.c use plain int to record and report the length of lines we receive. This means we truncate the result from read(2) in some circumstances. Use ssize_t to avoid that. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'lineread.h')
-rw-r--r--lineread.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/lineread.h b/lineread.h
index af86418..9203e28 100644
--- a/lineread.h
+++ b/lineread.h
@@ -18,14 +18,15 @@
* @buf: Buffer storing data read from file.
*/
struct lineread {
- int fd; int next_line;
- int count;
+ int fd;
+ ssize_t next_line;
+ ssize_t count;
/* One extra byte for possible trailing \0 */
char buf[LINEREAD_BUFFER_SIZE+1];
};
void lineread_init(struct lineread *lr, int fd);
-int lineread_get(struct lineread *lr, char **line);
+ssize_t lineread_get(struct lineread *lr, char **line);
#endif /* _LINEREAD_H */