Subject: Re: bin/32589
To: None <gnats-admin@netbsd.org, netbsd-bugs@netbsd.org, joerg@netbsd.org>
From: Daniel de Kok <danieldk@pobox.com>
List: netbsd-bugs
Date: 09/22/2006 19:25:01
The following reply was made to PR bin/32589; it has been noted by GNATS.

From: Daniel de Kok <danieldk@pobox.com>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: bin/32589
Date: Fri, 22 Sep 2006 21:24:09 +0200

 --UugvWAfsgieZRqgk
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
 
 How about this patch? FreeBSD exits when a directory could not be created.
 Since this may cause breakage, I have only added a warning.
 
 Take care,
 Daniel
 
 --UugvWAfsgieZRqgk
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: attachment; filename="xinstall.diff"
 
 Index: xinstall.c
 ===================================================================
 RCS file: /cvsroot/src/usr.bin/xinstall/xinstall.c,v
 retrieving revision 1.96
 diff -b -u -r1.96 xinstall.c
 --- xinstall.c	11 Sep 2006 22:24:09 -0000	1.96
 +++ xinstall.c	22 Sep 2006 19:18:31 -0000
 @@ -85,7 +85,7 @@
  int	numberedbackup;
  int	mode = S_IRWXU|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH;
  char	pathbuf[MAXPATHLEN];
 -id_t	uid = -1, gid = -1;
 +uid_t	uid, gid;
  char	*group, *owner, *fflags, *tags;
  FILE	*metafp;
  char	*metafile;
 @@ -99,7 +99,7 @@
  	DIGEST_NONE = 0,
  	DIGEST_MD5,
  	DIGEST_RMD160,
 -	DIGEST_SHA1,
 +	DIGEST_SHA1
  } digesttype = DIGEST_NONE;
  char	*digest;
  
 @@ -279,8 +279,7 @@
  		usage();
  
  	if (digest) {
 -		if (0) {
 -		} else if (strcmp(digest, "none") == 0) {
 +		if (strcmp(digest, "none") == 0) {
  			digesttype = DIGEST_NONE;
  		} else if (strcmp(digest, "md5") == 0) {
  			digesttype = DIGEST_MD5;
 @@ -1003,6 +1002,8 @@
  					err(1, "%s: mkdir", path);
                                  }
                          }
 +			else if (!S_ISDIR(sb.st_mode))
 +				warnx("%s exists but is not a directory", path);
                          if (!(*p = ch))
  				break;
                  }
 
 --UugvWAfsgieZRqgk--