diff options
author | Guillem Jover <guillem@debian.org> | 2011-05-10 20:02:28 +0200 |
---|---|---|
committer | Guillem Jover <guillem@debian.org> | 2012-06-30 06:35:24 +0200 |
commit | bd0da280d1b888b8709434ec405d1e8d33561756 (patch) | |
tree | c047d8c92390bd9012dcfe45079378b54382b1bf /dpkg-split/split.c | |
parent | bae98fb22f3ba9592772365ba23f37a02b4d55a0 (diff) | |
download | dpkg-bd0da280d1b888b8709434ec405d1e8d33561756.tar.gz |
libdpkg: Switch buffer I/O code to use struct dpkg_error
As a side effect this mkes the messages more clear as the caller has
more context to describe the error conditions.
Closes: #621763
Diffstat (limited to 'dpkg-split/split.c')
-rw-r--r-- | dpkg-split/split.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/dpkg-split/split.c b/dpkg-split/split.c index d18f81b59..fa406b857 100644 --- a/dpkg-split/split.c +++ b/dpkg-split/split.c @@ -51,6 +51,7 @@ static char * deb_field(const char *filename, const char *field) { + struct dpkg_error err; pid_t pid; int p[2]; struct varbuf buf = VARBUF_INIT; @@ -73,7 +74,9 @@ deb_field(const char *filename, const char *field) /* Parant reads from pipe. */ varbuf_reset(&buf); - fd_vbuf_copy(p[0], &buf, -1, _("package field value extraction")); + if (fd_vbuf_copy(p[0], &buf, -1, &err) < 0) + ohshit(_("cannot extract package field value from '%s': %s"), + filename, err.str); varbuf_end_str(&buf); close(p[0]); @@ -114,6 +117,7 @@ static int mksplit(const char *file_src, const char *prefix, off_t maxpartsize, bool msdos) { + struct dpkg_error err; int fd_src; struct stat st; char hash[MD5HASHLEN + 1]; @@ -134,7 +138,9 @@ mksplit(const char *file_src, const char *prefix, off_t maxpartsize, if (!S_ISREG(st.st_mode)) ohshit(_("source file `%.250s' not a plain file"), file_src); - fd_md5(fd_src, hash, -1, "md5hash"); + if (fd_md5(fd_src, hash, -1, &err) < 0) + ohshit(_("cannot compute MD5 hash for file '%s': %s"), + file_src, err.str); lseek(fd_src, 0, SEEK_SET); /* FIXME: Use libdpkg-deb. */ |