[PATCH] Make sure /var/empty dir really exists

Corinna Vinschen vinschen at redhat.com
Tue Feb 19 05:10:49 EST 2008


Hi,

could somebody please be so kind to apply the below patch to the Cygwin
specific file contrib/cygwin/ssh-host-config?  It checks more thorough
that it's possible to create the /var/empty directory.  It also fixes
bad English.


Thanks,
Corinna


Index: contrib/cygwin/ssh-host-config
===================================================================
RCS file: /cvs/openssh/contrib/cygwin/ssh-host-config,v
retrieving revision 1.20
diff -p -u -r1.20 ssh-host-config
--- contrib/cygwin/ssh-host-config	31 Aug 2006 01:28:49 -0000	1.20
+++ contrib/cygwin/ssh-host-config	18 Feb 2008 18:07:28 -0000
@@ -131,7 +131,7 @@ fi
 if [ -e "${SYSCONFDIR}" -a ! -d "${SYSCONFDIR}" ]
 then
   echo
-  echo "${SYSCONFDIR} is existant but not a directory."
+  echo "${SYSCONFDIR} exists but is not a directory."
   echo "Cannot create global configuration files."
   echo
   exit 1
@@ -156,7 +156,7 @@ fi
 if [ -e ${LOCALSTATEDIR}/log -a ! -d ${LOCALSTATEDIR}/log ]
 then
   echo
-  echo "${LOCALSTATEDIR}/log is existant but not a directory."
+  echo "${LOCALSTATEDIR}/log exists but is not a directory."
   echo "Cannot create ssh host configuration."
   echo
   exit 1
@@ -181,11 +181,23 @@ then
 fi
 
 # Create /var/empty file used as chroot jail for privilege separation
-if [ -f ${LOCALSTATEDIR}/empty ]
+if [ -e ${LOCALSTATEDIR}/empty -a ! -d ${LOCALSTATEDIR}/empty ]
 then
-  echo "Creating ${LOCALSTATEDIR}/empty failed!"
-else
-  mkdir -p ${LOCALSTATEDIR}/empty
+  echo
+  echo "${LOCALSTATEDIR}/empty exists but is not a directory."
+  echo "Cannot create ssh host configuration."
+  echo
+  exit 1
+if [ ! -e ${LOCALSTATEDIR}/empty ]
+then
+  if ! mkdir -p ${LOCALSTATEDIR}/empty
+  then
+    echo
+    echo "Creating ${LOCALSTATEDIR}/empty directory failed."
+    echo "Cannot create ssh host configuration."
+    echo
+    exit 1
+  fi
   if [ ${_nt} -gt 0 ]
   then
     chmod 755 ${LOCALSTATEDIR}/empty


-- 
Corinna Vinschen
Cygwin Project Co-Leader
Red Hat


More information about the openssh-unix-dev mailing list