diff options
| author | Mattias Andrée <maandree@kth.se> | 2017-04-08 23:02:48 +0200 |
|---|---|---|
| committer | Mattias Andrée <maandree@kth.se> | 2017-04-08 23:02:48 +0200 |
| commit | 0804a80954bf9b8c11392d77a4933ec0a4ff635b (patch) | |
| tree | d19ab7658b07089af643deba41ec73f696925e54 /src/util.c | |
| parent | Document memory requirements, minor style fixes, more use of BUFSIZ, fix warnings, and fix potential buffer overflow (diff) | |
| download | blind-0804a80954bf9b8c11392d77a4933ec0a4ff635b.tar.gz blind-0804a80954bf9b8c11392d77a4933ec0a4ff635b.tar.bz2 blind-0804a80954bf9b8c11392d77a4933ec0a4ff635b.tar.xz | |
Add blind-translate and fix errors
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'src/util.c')
| -rw-r--r-- | src/util.c | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -157,6 +157,18 @@ pwriteall(int fd, void *buf, size_t n, size_t ptr) return 0; } +int +writezeroes(int fd, void *buf, size_t bufsize, size_t n) +{ + size_t p, m; + for (p = 0; p < n; p += m) { + m = bufsize < n - p ? bufsize : n - p; + if (writeall(fd, buf, m)) + return -1; + } + return 0; +} + static inline pid_t enfork(int status) |
