aboutsummaryrefslogtreecommitdiff
path: root/src/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/util.c')
-rw-r--r--src/util.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/util.c b/src/util.c
index 3da294b..85914ca 100644
--- a/src/util.c
+++ b/src/util.c
@@ -95,7 +95,6 @@ char *read_string(int fd)
{
error("read_string: EOF");
}
- debugf("sz is %d\n", sz);
char *ret = malloc(sz + 1);
if(read(fd, ret, sz) < 0)
{
@@ -119,3 +118,17 @@ void write_bool(int fd, bool b)
if(write(fd, &b, sizeof(b)) != sizeof(b))
error("write failed");
}
+
+uint32_t read_uint32(int fd)
+{
+ uint32_t ret;
+ if(read(fd, &ret, sizeof(ret)) != sizeof(ret))
+ error("unexpected EOF");
+ return ret;
+}
+
+void write_uint32(int fd, uint32_t b)
+{
+ if(write(fd, &b, sizeof(b)) != sizeof(b))
+ error("write failed");
+}