[patch iwhd 1/3] Add dc-rhev-image

Pete Zaitcev zaitcev at redhat.com
Tue Mar 1 22:56:08 UTC 2011


On Tue, 01 Mar 2011 16:21:26 +0100
Jim Meyering <jim at meyering.net> wrote:

> > +	if (!json_is_string(elem)) {
> > +		fprintf(stderr,
> > +		    "ERROR configuration %s: tag %s is not a string\n",
> > +		    cfgname, cfgtag);
> > +		exit(2);
> 
> In place of each use of fprintf, iwhd makes an effort to use error.

That's fine, but dc-rhev-image makes an effort to mimic dc-register-image,
which inherits the error format from ec2-api-tools (and also euca2ools).

> > +	if (mkdir(tmpovfdir, 0770) < 0) {
> > +		fprintf(stderr, "ERROR Failed to make directory %s: %s\n",
> > +		    tmpovfdir, strerror(errno));
> +		exit(1);
> +	}
> 
> I'd write this:
> 
>    	if (mkdir(tmpovfdir, 0770) < 0)
>    		error(EXIT_FAILURE, error,
>                       "ERROR Failed to make directory %s\n", tmpovfdir);

This needs a new parsing code in iwhd. I found it easier to copy
the code from s3_register().

Obviously it's not watertight anymore, thanks to your insistence
on copy_file_preserving. That piece of ... code exits on error
with an out-of-format message, which eventually ends in DPRINTF
in angled brackets.

-- Pete


More information about the iwhd-devel mailing list