diff --git a/format.c b/format.c index c3d8c0f826f8..ee659dd29c47 100644 --- a/format.c +++ b/format.c @@ -65,3 +65,13 @@ format_selected(void) return (format); } + +int +format_write(int fd) +{ + + if (format == NULL) + return (ENOSYS); + + return (format->write(fd)); +} diff --git a/format.h b/format.h index 11b3ab5dc9b5..76750bdc2c53 100644 --- a/format.h +++ b/format.h @@ -42,5 +42,6 @@ SET_DECLARE(formats, struct mkimg_format); int format_select(const char *); struct mkimg_format *format_selected(void); +int format_write(int); #endif /* _MKIMG_FORMAT_H_ */ diff --git a/mkimg.c b/mkimg.c index 67037cb3e7aa..adee151ccf88 100644 --- a/mkimg.c +++ b/mkimg.c @@ -451,7 +451,7 @@ main(int argc, char *argv[]) fprintf(stderr, "Number of cylinders: %u\n", ncyls); } - error = image_copyout(outfd); + error = format_write(outfd); if (error) errc(EX_IOERR, error, "writing image"); diff --git a/raw.c b/raw.c index 804b3352ebff..0fd64d129347 100644 --- a/raw.c +++ b/raw.c @@ -40,10 +40,10 @@ __FBSDID("$FreeBSD$"); #include "mkimg.h" static int -raw_write(int fd __unused) +raw_write(int fd) { - return (ENOSYS); + return (image_copyout(fd)); } static struct mkimg_format raw_format = {