projects
/
mmh
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
* patch #3966: Create a mh_xmalloc function to prevent mistakes when
[mmh]
/
uip
/
mhlsbr.c
diff --git
a/uip/mhlsbr.c
b/uip/mhlsbr.c
index
d707ed1
..
af3fa55
100644
(file)
--- a/
uip/mhlsbr.c
+++ b/
uip/mhlsbr.c
@@
-14,6
+14,7
@@
#include <h/addrsbr.h>
#include <h/fmt_scan.h>
#include <h/tws.h>
#include <h/addrsbr.h>
#include <h/fmt_scan.h>
#include <h/tws.h>
+#include <h/utils.h>
#include <setjmp.h>
#include <signal.h>
#include <setjmp.h>
#include <signal.h>
@@
-480,6
+481,11
@@
mhl (int argc, char **argv)
vecp > 1 ? "s" : "");
}
vecp > 1 ? "s" : "");
}
+ fflush(stdout);
+ if(ferror(stdout)){
+ adios("output", "error writing");
+ }
+
if (clearflg > 0 && ontty == NOTTY)
clear_screen ();
if (clearflg > 0 && ontty == NOTTY)
clear_screen ();
@@
-950,8
+956,7
@@
mhlfile (FILE *fp, char *mname, int ofilen, int ofilec)
continue;
}
if (dobody && !strcasecmp (c1->c_name, "body")) {
continue;
}
if (dobody && !strcasecmp (c1->c_name, "body")) {
- if ((holder.c_text = malloc (sizeof(buf))) == NULL)
- adios (NULL, "unable to allocate buffer memory");
+ holder.c_text = mh_xmalloc (sizeof(buf));
strncpy (holder.c_text, buf, sizeof(buf));
while (state == BODY) {
putcomp (c1, &holder, BODYCOMP);
strncpy (holder.c_text, buf, sizeof(buf));
while (state == BODY) {
putcomp (c1, &holder, BODYCOMP);
@@
-1645,8
+1650,7
@@
doface (struct mcomp *c1)
cp = dp, len = j;
}
else {
cp = dp, len = j;
}
else {
- if ((cp = malloc ((unsigned) i)) == NULL)
- adios (NULL, "unable to allocate face storage");
+ cp = mh_xmalloc ((unsigned) i);
memcpy(cp, buffer, i);
len = i;
}
memcpy(cp, buffer, i);
len = i;
}