projects
/
mymail.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
4763d78
)
Cosmetics in the error messages for safe functions.
author
Francois Fleuret
<francois@fleuret.org>
Sat, 8 Jun 2013 20:38:40 +0000
(22:38 +0200)
committer
Francois Fleuret
<francois@fleuret.org>
Sat, 8 Jun 2013 20:38:40 +0000
(22:38 +0200)
mymail.c
patch
|
blob
|
history
diff --git
a/mymail.c
b/mymail.c
index
c1b09be
..
347f2a4
100644
(file)
--- a/
mymail.c
+++ b/
mymail.c
@@
-200,7
+200,7
@@
void *safe_malloc(size_t n) {
void *p = malloc(n);
if(!p && n != 0) {
fprintf(stderr,
void *p = malloc(n);
if(!p && n != 0) {
fprintf(stderr,
- "
selector
: cannot allocate memory: %s\n", strerror(errno));
+ "
mymail
: cannot allocate memory: %s\n", strerror(errno));
exit(EXIT_FAILURE);
}
return p;
exit(EXIT_FAILURE);
}
return p;
@@
-212,8
+212,9
@@
FILE *safe_fopen(const char *path, const char *mode, const char *comment) {
return result;
} else {
fprintf(stderr,
return result;
} else {
fprintf(stderr,
- "mymail: Cannot open file '%s' (%s) with mode \"%s\".\n",
- path, comment, mode);
+ "mymail: Cannot open file '%s' (%s) with mode \"%s\": %s\n",
+ path, comment, mode,
+ strerror(errno));
exit(EXIT_FAILURE);
}
}
exit(EXIT_FAILURE);
}
}