The following commit has been merged in the master branch:
commit 7121152571589de8037f431bbfb0654733c5815b
Author: Guillem Jover <[email protected]>
Date:   Sun Sep 6 06:37:01 2009 +0200

    libdpkg: New m_output function
    
    This function makes sure to output the information printed on the file
    specified, and ohshites if there's any error.

diff --git a/lib/dpkg/dpkg.h b/lib/dpkg/dpkg.h
index 38dbc10..32279e6 100644
--- a/lib/dpkg/dpkg.h
+++ b/lib/dpkg/dpkg.h
@@ -205,6 +205,7 @@ char *m_strdup(const char *str);
 int m_fork(void);
 void m_dup2(int oldfd, int newfd);
 void m_pipe(int fds[2]);
+void m_output(FILE *f, const char *name);
 
 /*** from utils.c ***/
 
diff --git a/lib/dpkg/mlib.c b/lib/dpkg/mlib.c
index 71a6889..eee1c50 100644
--- a/lib/dpkg/mlib.c
+++ b/lib/dpkg/mlib.c
@@ -116,6 +116,14 @@ void m_pipe(int *fds) {
   ohshite(_("failed to create pipe"));
 }
 
+void
+m_output(FILE *f, const char *name)
+{
+  fflush(f);
+  if (ferror(f))
+    ohshite(_("error writing to '%s'"), name);
+}
+
 void setcloexec(int fd, const char* fn) {
   int f;
 

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to