]> cygwin.com Git - cygwin-apps/setup.git/commitdiff
* path.c (exit_cygpath): Wait for subprocess to exit before returning.
authorChristopher Faylor <me@cgf.cx>
Mon, 1 May 2000 02:42:14 +0000 (02:42 +0000)
committerChristopher Faylor <me@cgf.cx>
Mon, 1 May 2000 02:42:14 +0000 (02:42 +0000)
(cygpath_pipe): Don't call exit_cygpath.  Let main atexit routine do that.
* pkg.c (init_pkgs): Accept root argument.  Make registry key "cygwin
root"-specific.
* setup.c (filedel): Call exit_cygpath here so that we can be assured that
cygpath subprocess has died.  This allows us to delete cygpath.exe and
cygwin1.dll.
(optionprompt): Initialize response to -1 so that second screen of mirrors will
appear.
(get_pkg_stuff): Don't attempt to use HKCLU.  Pass root to init_pkgs.
* setup.h: Reflect init_pkgs prototype change.

ChangeLog
path.c
pkg.c
setup.c
setup.h

index 6db1cc9ee880ee11d8f0a658252c199ccfc7d860..c453e27c58731b39e2ef8b63fa63fbc6f29d122d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+Sun Apr 30 22:37:34 2000  Christopher Faylor <cgf@cygnus.com>
+
+       * path.c (exit_cygpath): Wait for subprocess to exit before returning.
+       (cygpath_pipe): Don't call exit_cygpath.  Let main atexit routine do
+       that.
+       * pkg.c (init_pkgs): Accept root argument.  Make registry key "cygwin
+       root"-specific.
+       * setup.c (filedel): Call exit_cygpath here so that we can be assured
+       that cygpath subprocess has died.  This allows us to delete cygpath.exe
+       and cygwin1.dll.
+       (optionprompt): Initialize response to -1 so that second screen of
+       mirrors will appear.
+       (get_pkg_stuff): Don't attempt to use HKCLU.  Pass root to init_pkgs.
+       * setup.h: Reflect init_pkgs prototype change.
+
 Sat Apr 29 23:53:30 2000  Christopher Faylor <cgf@cygnus.com>
 
        * pkg.c (init_pkgs): Accept an argument to control what root registry
diff --git a/path.c b/path.c
index 7a6eebfe34e7c403c9b65db64a6d54d08536a34d..827f5dd74b5a6452b8ed6d54e838f028c3cde2c1 100644 (file)
--- a/path.c
+++ b/path.c
@@ -44,17 +44,22 @@ kill_cygpath (int sig)
   exit (1);
 }
 
-static void
+void
 exit_cygpath (void)
 {
   fclose (cygin);
   fclose (cygout);
   Sleep (0);
-  TerminateProcess (hcygpath, 0);
+  if (WaitForSingleObject (hcygpath, 5000) != WAIT_OBJECT_0)
+    {
+      TerminateProcess (hcygpath, 0);
+      WaitForSingleObject (hcygpath, 5000);
+    }
+  CloseHandle (hcygpath);
 }
 
 static int
-cygpath_pipe ()
+cygpath_pipe (void)
 {
   int hpipein[2] = {-1, -1};
   int hpipeout[2] = {-1, -1};
@@ -72,7 +77,6 @@ cygpath_pipe ()
   hcygpath = (HANDLE) xcreate_process (0, hout, hin, hin, buffer);
   if (!hcygpath)
     return 0;
-  atexit (exit_cygpath);
   signal (SIGINT, kill_cygpath);
   _close (hpipein[1]);
   _close (hpipeout[0]);
diff --git a/pkg.c b/pkg.c
index ddbc90b274bf85a108ff5a4cd76296ee84f58f3b..e8a352b7ee65817315db7e75d53db27f4646b1be 100644 (file)
--- a/pkg.c
+++ b/pkg.c
@@ -218,20 +218,25 @@ err:
   return NULL;
 }
 
+#define REGWHERE "SOFTWARE\\Cygnus Solutions\\Cygwin\\Installed Components"
+
 pkg *
-init_pkgs (int use_current_user)
+init_pkgs (const char *root, int use_current_user)
 {
   LONG res;
   DWORD what;
-  char empty[] = "";
+  char *p, empty[] = "";
   char buf[4096];
   DWORD ty, sz;
   DWORD nc = 0;
   static pkg stuff[1000];
 
-  res = RegCreateKeyEx (use_current_user ? HKEY_CURRENT_USER : HKEY_LOCAL_MACHINE,
-                       "SOFTWARE\\Cygnus Solutions\\Cygwin\\Installed Components",
-                        0, empty,  REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hkpkg, &what);
+  sprintf (buf, "%s\\%s", REGWHERE, root);
+  for (p = buf + sizeof (REGWHERE); (p = strchr (p, '\\')) != NULL; )
+    *p = '/';
+  
+  res = RegCreateKeyEx (use_current_user ? HKEY_CURRENT_USER : HKEY_LOCAL_MACHINE, buf,
+                       0, empty,  REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hkpkg, &what);
 
   if (res != ERROR_SUCCESS)
     return NULL;
diff --git a/setup.c b/setup.c
index 9310dd366747ee97d8659227a8433139f95487be..620530f8a9fd283f8f384939abbd9e283ff2c93b 100644 (file)
--- a/setup.c
+++ b/setup.c
@@ -65,9 +65,12 @@ static SA installme = {NULL, 0, 0};
 static void
 filedel (void)
 {
-  int i;
+  int i, j;
+  extern void exit_cygpath (void);
+  exit_cygpath ();
   for (i = 0; i < deleteme.count; i++)
-    (void) _unlink (deleteme.array[i]);
+    for (j = 0; _unlink (deleteme.array[i]) && j < 20; j++)
+      Sleep (100);
   sa_cleanup (&deleteme);
 }
 
@@ -140,7 +143,6 @@ create_shortcut (const char *target, const char *shortcut)
   return SUCCEEDED (hres);
 }
 
-
 BOOL CALLBACK
 output_file (HMODULE h, LPCTSTR type, LPTSTR name, LONG lparam)
 {
@@ -433,7 +435,6 @@ recurse_dirs (SA *installme, const char *dir)
   return retval;
 }
 
-
 static void
 setpath (const char *element)
 {
@@ -450,7 +451,6 @@ prompt (const char *text, const char *def)
 {
   char buffer[_MAX_PATH];
 
-
   printf ((def ? "%s? [%s] " : "%s? "), text, def);
   fflush (stdout);
   fgets (buffer, sizeof (buffer), stdin);
@@ -463,7 +463,7 @@ prompt (const char *text, const char *def)
 static int
 optionprompt (const char *text, SA * options)
 {
-  size_t n, response = 1;
+  size_t n, response = -1;
   char buf[5];
   size_t base;
 
@@ -986,7 +986,6 @@ downloaddir (SA *installme, const char *url)
   return retval;
 }
 
-
 static HINTERNET
 opensession ()
 {
@@ -1083,7 +1082,6 @@ create_uninstall (const char *wd, const char *folder, const char *shellscut,
   return retval;
 }
 
-
 /* Writes the startup batch file. */
 static int
 do_start_menu (const char *root)
@@ -1262,7 +1260,6 @@ getdownloadsource ()
   return retval;
 }
 
-
 /* Basically a mkdir -p /somedir function. */
 static void
 mkdirp (const char *dir)
@@ -1321,11 +1318,9 @@ static pkg *
 get_pkg_stuff (const char *root, int updating)
 {
   const char *ver, *ans;
-  pkg *pkgstuff = init_pkgs (0);
+  pkg *pkgstuff = init_pkgs (root, 0);
   static pkg dummy = {NULL, NULL};
 
-  if (!pkgstuff)
-    pkgstuff = init_pkgs (1);  /* Use HKCU */
   if (!updating || !pkgstuff)
     return &dummy;
 
diff --git a/setup.h b/setup.h
index e3b25d30ab735beacaeec3a722841948559c345f..00eadf283afef1182ac04680f8eddb1da63a2d01 100644 (file)
--- a/setup.h
+++ b/setup.h
@@ -23,7 +23,7 @@ typedef struct
   char *version;
 } pkg;
 
-pkg *init_pkgs (int);
+pkg *init_pkgs (const char * root, int);
 pkg * find_pkg (pkg *stuff, char *name);
 int write_pkg (pkg *pkg, char *name, char *version);
 int newer_pkg (pkg *pkg, char *version);
This page took 0.04012 seconds and 5 git commands to generate.