Commit Graph

4 Commits

Author SHA1 Message Date
Colin Patrick McCabe
4de7fd4931 common: safe_io: allow C files to include safe_io
Don't use extern C unless we're compiling with C++.
This allows C files to include safe_io.h

Signed-off-by: Colin McCabe <colin.mccabe@dreamhost.com>
2011-02-10 05:47:42 -08:00
Colin Patrick McCabe
a743e314b9 common:safe_io: create exact and non-exact variant
Create safe_read_exact, which fails with -EDOM unless it reads exactly
the requested number of bytes. More often, what we want is the
semantics of safe_read, which returns the number of bytes it read, or
negative on error. Likewise for pread.

Write doesn't need variants because failing to write all the bytes is
always an error.

Signed-off-by: Colin McCabe <colin.mccabe@dreamhost.com>
2011-02-10 04:58:47 -08:00
Sage Weil
071159991d safe_io: move to C
Fixes unistd vs XOPEN_SOURCE define weirdness.

Signed-off-by: Sage Weil <sage.weil@dreamhost.com>
2011-02-07 12:12:51 -08:00
Sage Weil
79983c27bc add safe_{read/write} wrappers
Signed-off-by: Sage Weil <sage.weil@dreamhost.com>
2011-02-07 11:59:15 -08:00