Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2004-01-24 02:04:27 +0300
committerChristopher Faylor <me@cgf.cx>2004-01-24 02:04:27 +0300
commit7dddf53f5caee354852156ce552859c0bc81a3c7 (patch)
tree7e4b450d411f8ab26c795da5670571aa8b73a0e9 /winsup/utils
parentf892e76346e5270b6786e96c1b6bd0d8b7a2a377 (diff)
* cygcheck.cc (pretty_id): Make more robust in absence of id.exe.
Diffstat (limited to 'winsup/utils')
-rw-r--r--winsup/utils/ChangeLog4
-rw-r--r--winsup/utils/cygcheck.cc19
2 files changed, 20 insertions, 3 deletions
diff --git a/winsup/utils/ChangeLog b/winsup/utils/ChangeLog
index 907f46bc0..cca686c46 100644
--- a/winsup/utils/ChangeLog
+++ b/winsup/utils/ChangeLog
@@ -1,3 +1,7 @@
+2004-01-23 Christopher Faylor <cgf@redhat.com>
+
+ * cygcheck.cc (pretty_id): Make more robust in absence of id.exe.
+
2004-01-22 Corinna Vinschen <corinna@vinschen.de>
* cygpath.cc (dowin): Revert accidental checkin from November.
diff --git a/winsup/utils/cygcheck.cc b/winsup/utils/cygcheck.cc
index 7adc4c1ec..9652a5ba5 100644
--- a/winsup/utils/cygcheck.cc
+++ b/winsup/utils/cygcheck.cc
@@ -780,14 +780,27 @@ pretty_id (const char *s, char *cygwin, size_t cyglen)
*p = '\\';
if (access (id, X_OK))
- fprintf (stderr, "`id' program not found\n");
+ {
+ fprintf (stderr, "`id' program not found\n");
+ return;
+ }
FILE *f = popen (id, "rt");
char buf[16384];
+ static char empty[] = "";
+ buf[0] = '\0';
fgets (buf, sizeof (buf), f);
- char *uid = strtok (buf, ")") + strlen ("uid=");
- char *gid = strtok (NULL, ")") + strlen ("gid=") + 1;
+ char *uid = strtok (buf, ")");
+ if (uid)
+ uid += strlen ("uid=");
+ else
+ uid = empty;
+ char *gid = strtok (NULL, ")");
+ if (gid)
+ gid += strlen ("gid=") + 1;
+ else
+ gid = empty;
char **ng;
size_t sz = 0;
for (ng = groups; (*ng = strtok (NULL, ",")); ng++)