[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 06/14] cutils: introduce qemu_fwrite_err()
From: |
Luiz Capitulino |
Subject: |
[Qemu-devel] [PATCH 06/14] cutils: introduce qemu_fwrite_err() |
Date: |
Fri, 25 May 2012 16:41:11 -0300 |
A fwrite() wrapper that takes an Error argument.
Signed-off-by: Luiz Capitulino <address@hidden>
---
cutils.c | 15 +++++++++++++++
qemu-common.h | 2 ++
2 files changed, 17 insertions(+)
diff --git a/cutils.c b/cutils.c
index 83edb43..63fdfc0 100644
--- a/cutils.c
+++ b/cutils.c
@@ -634,3 +634,18 @@ int qemu_fputc_err(int c, FILE *stream, Error **errp)
return ret;
}
+
+size_t qemu_fwrite_err(const void *ptr, size_t size, size_t nmemb,
+ FILE *stream, Error **errp)
+{
+ size_t ret;
+
+ clearerr(stream);
+ ret = fwrite(ptr, size, nmemb, stream);
+
+ if (ferror(stream)) {
+ set_write_err(errp, errno);
+ }
+
+ return ret;
+}
diff --git a/qemu-common.h b/qemu-common.h
index 895bc2b..39377ff 100644
--- a/qemu-common.h
+++ b/qemu-common.h
@@ -212,6 +212,8 @@ int qemu_sendv(int sockfd, struct iovec *iov, int len, int
iov_offset);
FILE *qemu_fopen_err(const char *path, const char *mode, Error **errp);
int qemu_fprintf_err(Error **errp, FILE *stream, const char *format, ...);
int qemu_fputc_err(int c, FILE *stream, Error **errp);
+size_t qemu_fwrite_err(const void *ptr, size_t size, size_t nmemb,
+ FILE *stream, Error **errp);
/* Error handling. */
--
1.7.10.2.565.gbd578b5
- [Qemu-devel] [PATCH qmp-next 00/14]: qapi: convert screendump, Luiz Capitulino, 2012/05/25
- [Qemu-devel] [PATCH 01/14] qerror: extend QERR_TOO_MANY_FILES, Luiz Capitulino, 2012/05/25
- [Qemu-devel] [PATCH 02/14] qerror: add new errors, Luiz Capitulino, 2012/05/25
- [Qemu-devel] [PATCH 03/14] cutils: introduce qemu_fopen_err(), Luiz Capitulino, 2012/05/25
- [Qemu-devel] [PATCH 04/14] cutils: introduce qemu_fprintf_err(), Luiz Capitulino, 2012/05/25
- [Qemu-devel] [PATCH 05/14] cutils: introduce qemu_fputc_err(), Luiz Capitulino, 2012/05/25
- [Qemu-devel] [PATCH 06/14] cutils: introduce qemu_fwrite_err(),
Luiz Capitulino <=
- [Qemu-devel] [PATCH 07/14] omap_lcdc: rename ppm_save() to omap_ppm_save(), Luiz Capitulino, 2012/05/25
- [Qemu-devel] [PATCH 08/14] console: vga_hw_screen_dump_ptr: take an Error argument, Luiz Capitulino, 2012/05/25
- [Qemu-devel] [PATCH 09/14] vga: ppm_save(): add error handling, Luiz Capitulino, 2012/05/25
- [Qemu-devel] [PATCH 12/14] tcx: tcx24_screen_dump(): add error handling, Luiz Capitulino, 2012/05/25
- [Qemu-devel] [PATCH 13/14] tcx: tcx_screen_dump(): add error handling, Luiz Capitulino, 2012/05/25
- [Qemu-devel] [PATCH 10/14] omap_lcdc: omap_ppm_save(): add error handling, Luiz Capitulino, 2012/05/25
- [Qemu-devel] [PATCH 14/14] qapi: convert screendump, Luiz Capitulino, 2012/05/25
- [Qemu-devel] [PATCH 11/14] g364fb: g364fb_screen_dump(): add error handling, Luiz Capitulino, 2012/05/25