[Libguestfs] [PATCH 2/3] febootstrap/helper/init: Add translations for errno
Richard W.M. Jones
rjones at redhat.com
Mon Jun 6 13:14:11 UTC 2011
On Sun, Jun 05, 2011 at 01:02:49AM +0200, Hilko Bengen wrote:
> ---
> helper/init.c | 19 ++++++++++++++++++-
> 1 files changed, 18 insertions(+), 1 deletions(-)
>
> diff --git a/helper/init.c b/helper/init.c
> index 2b5dacf..50ed19e 100644
> --- a/helper/init.c
> +++ b/helper/init.c
> @@ -40,6 +40,23 @@
>
> extern long init_module (void *, unsigned long, const char *);
>
> +/* translation taken from module-init-tools/insmod.c */
> +static const char *moderror(int err)
> +{
> + switch (err) {
> + case ENOEXEC:
> + return "Invalid module format";
> + case ENOENT:
> + return "Unknown symbol in module";
> + case ESRCH:
> + return "Module has wrong symbol version";
> + case EINVAL:
> + return "Invalid parameters";
> + default:
> + return strerror(err);
> + }
> +}
> +
> /* Leave this enabled for now. When we get more confident in the boot
> * process we can turn this off or make it configurable.
> */
> @@ -212,7 +229,7 @@ insmod (const char *filename)
> close (fd);
>
> if (init_module (buf, st.st_size, "") != 0) {
> - fprintf (stderr, "insmod: init_module: %s: %m\n", filename);
> + fprintf (stderr, "insmod: init_module: %s: %s\n", filename, moderror (errno));
> /* However ignore the error because this can just happen because
> * of a missing device.
> */
> --
> 1.7.5.3
Thanks, applied.
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
New in Fedora 11: Fedora Windows cross-compiler. Compile Windows
programs, test, and build Windows installers. Over 70 libraries supprt'd
http://fedoraproject.org/wiki/MinGW http://www.annexia.org/fedora_mingw
More information about the Libguestfs
mailing list