diff options
| author | Franklin Wei <frankhwei536@gmail.com> | 2016-01-26 19:22:53 -0500 |
|---|---|---|
| committer | Franklin Wei <frankhwei536@gmail.com> | 2016-01-26 19:27:13 -0500 |
| commit | 3749a7f457f8360381eb373a639140e4e93a152a (patch) | |
| tree | 7fd7dffd98d0bfd3bdf20e24b184ec5440ca3909 /src/util.c | |
| parent | 955c292d0d12f7f438d7b279689e9f08458dbd40 (diff) | |
| download | netcosm-0.4.0-rc1.zip netcosm-0.4.0-rc1.tar.gz netcosm-0.4.0-rc1.tar.bz2 netcosm-0.4.0-rc1.tar.xz | |
fix a memory leak, bumps version to 0.4.0-rc10.4.0-rc1
Diffstat (limited to 'src/util.c')
| -rw-r--r-- | src/util.c | 15 |
1 files changed, 14 insertions, 1 deletions
@@ -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"); +} |