diff options
| author | 2016-10-16 17:08:53 +0000 | |
|---|---|---|
| committer | 2016-10-16 17:08:53 +0000 | |
| commit | 6163fc9c984792a236538701be951c6cbd2c78ab (patch) | |
| tree | 3557f96b4c5712bbd30afdcccbd5ccdd90cc1f8c /usr.sbin/makefs/xmalloc.c | |
| parent | Quiet compiler warnings; as applied to usr.bin/cvs by millert@ (diff) | |
| download | wireguard-openbsd-6163fc9c984792a236538701be951c6cbd2c78ab.tar.xz wireguard-openbsd-6163fc9c984792a236538701be951c6cbd2c78ab.zip | |
Import makefs - a tool to create filesystem images from a directory.
This is a rough port of the NetBSD tool with some features removed we
don't need. It compiles, but I don't promise anything more. Importing
now, so we can hack on it in tree.
The supported filesystem types are: cd9660, ffs and msdosfs.
ok deraadt
Diffstat (limited to 'usr.sbin/makefs/xmalloc.c')
| -rw-r--r-- | usr.sbin/makefs/xmalloc.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/usr.sbin/makefs/xmalloc.c b/usr.sbin/makefs/xmalloc.c new file mode 100644 index 00000000000..1a0e22d2094 --- /dev/null +++ b/usr.sbin/makefs/xmalloc.c @@ -0,0 +1,43 @@ +#include <err.h> +#include <stdlib.h> +#include <string.h> + +void * +emalloc(size_t size) +{ + void *v; + + if ((v = malloc(size)) == NULL) + err(1, "malloc"); + return v; +} + +void * +ecalloc(size_t nmemb, size_t size) +{ + void *v; + + if ((v = calloc(nmemb, size)) == NULL) + err(1, "calloc"); + return v; +} + +void * +erealloc(void *ptr, size_t size) +{ + void *v; + + if ((v = realloc(ptr, size)) == NULL) + err(1, "realloc"); + return v; +} + +char * +estrdup(const char *s) +{ + char *s2; + + if ((s2 = strdup(s)) == NULL) + err(1, "strdup"); + return s2; +} |
