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>2003-01-26 09:42:40 +0300
committerChristopher Faylor <me@cgf.cx>2003-01-26 09:42:40 +0300
commit9a751621661bab473334333b4422599bc26164a2 (patch)
tree742a43bdccdc8dec7c86ddf6813f6f82aa465c5a /winsup/cygwin
parent989c97fe141b5869c3dfd438683b14a8bc8453ca (diff)
* uinfo.cc (pwdgrp::load): Regularize strace output. Add warning for
CreateFile failure.
Diffstat (limited to 'winsup/cygwin')
-rw-r--r--winsup/cygwin/ChangeLog5
-rw-r--r--winsup/cygwin/fhandler_floppy.cc192
-rw-r--r--winsup/cygwin/fhandler_socket.cc2
-rw-r--r--winsup/cygwin/grp.cc10
-rw-r--r--winsup/cygwin/net.cc4
-rw-r--r--winsup/cygwin/sec_acl.cc10
-rw-r--r--winsup/cygwin/sec_helper.cc4
-rw-r--r--winsup/cygwin/security.cc6
-rw-r--r--winsup/cygwin/syscalls.cc2
-rw-r--r--winsup/cygwin/uinfo.cc9
10 files changed, 126 insertions, 118 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 629a04bc5..7ad151b88 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,5 +1,10 @@
2003-01-26 Christopher Faylor <cgf@redhat.com>
+ * uinfo.cc (pwdgrp::load): Regularize strace output. Add warning for
+ CreateFile failure.
+
+2003-01-26 Christopher Faylor <cgf@redhat.com>
+
* passwd.cc (pwdgrp::parse_passwd): Eliminate use of memset. The
structure should always be completely filled out.
* grp.cc (pwdgrp::parse_group): Ditto.
diff --git a/winsup/cygwin/fhandler_floppy.cc b/winsup/cygwin/fhandler_floppy.cc
index fe338317b..e5da2418d 100644
--- a/winsup/cygwin/fhandler_floppy.cc
+++ b/winsup/cygwin/fhandler_floppy.cc
@@ -201,112 +201,112 @@ fhandler_dev_floppy::ioctl (unsigned int cmd, void *buf)
{
case HDIO_GETGEO:
{
- debug_printf ("HDIO_GETGEO");
- if (!DeviceIoControl (get_handle (),
- IOCTL_DISK_GET_DRIVE_GEOMETRY,
- NULL, 0,
- &di, sizeof (di),
- &bytes_read, NULL))
- {
- __seterrno ();
- return -1;
- }
- debug_printf ("disk geometry: (%ld cyl)*(%ld trk)*(%ld sec)*(%ld bps)",
- di.Cylinders.LowPart,
- di.TracksPerCylinder,
- di.SectorsPerTrack,
- di.BytesPerSector);
- if (DeviceIoControl (get_handle (),
- IOCTL_DISK_GET_PARTITION_INFO,
- NULL, 0,
- &pi, sizeof (pi),
- &bytes_read, NULL))
- {
- debug_printf ("partition info: %ld (%ld)",
- pi.StartingOffset.LowPart,
- pi.PartitionLength.LowPart);
- start = pi.StartingOffset.QuadPart >> 9ULL;
- }
- struct hd_geometry *geo = (struct hd_geometry *) buf;
- geo->heads = di.TracksPerCylinder;
- geo->sectors = di.SectorsPerTrack;
- geo->cylinders = di.Cylinders.LowPart;
- geo->start = start;
- return 0;
+ debug_printf ("HDIO_GETGEO");
+ if (!DeviceIoControl (get_handle (),
+ IOCTL_DISK_GET_DRIVE_GEOMETRY,
+ NULL, 0,
+ &di, sizeof (di),
+ &bytes_read, NULL))
+ {
+ __seterrno ();
+ return -1;
+ }
+ debug_printf ("disk geometry: (%ld cyl)*(%ld trk)*(%ld sec)*(%ld bps)",
+ di.Cylinders.LowPart,
+ di.TracksPerCylinder,
+ di.SectorsPerTrack,
+ di.BytesPerSector);
+ if (DeviceIoControl (get_handle (),
+ IOCTL_DISK_GET_PARTITION_INFO,
+ NULL, 0,
+ &pi, sizeof (pi),
+ &bytes_read, NULL))
+ {
+ debug_printf ("partition info: %ld (%ld)",
+ pi.StartingOffset.LowPart,
+ pi.PartitionLength.LowPart);
+ start = pi.StartingOffset.QuadPart >> 9ULL;
+ }
+ struct hd_geometry *geo = (struct hd_geometry *) buf;
+ geo->heads = di.TracksPerCylinder;
+ geo->sectors = di.SectorsPerTrack;
+ geo->cylinders = di.Cylinders.LowPart;
+ geo->start = start;
+ return 0;
}
case BLKGETSIZE:
case BLKGETSIZE64:
{
- debug_printf ("BLKGETSIZE");
- if (!DeviceIoControl (get_handle (),
- IOCTL_DISK_GET_DRIVE_GEOMETRY,
- NULL, 0,
- &di, sizeof (di),
- &bytes_read, NULL))
- {
- __seterrno ();
- return -1;
- }
- debug_printf ("disk geometry: (%ld cyl)*(%ld trk)*(%ld sec)*(%ld bps)",
- di.Cylinders.LowPart,
- di.TracksPerCylinder,
- di.SectorsPerTrack,
- di.BytesPerSector);
- if (DeviceIoControl (get_handle (),
- IOCTL_DISK_GET_PARTITION_INFO,
- NULL, 0,
- &pi, sizeof (pi),
- &bytes_read, NULL))
- {
- debug_printf ("partition info: %ld (%ld)",
- pi.StartingOffset.LowPart,
- pi.PartitionLength.LowPart);
- drive_size = pi.PartitionLength.QuadPart;
- }
- else
- {
- drive_size = di.Cylinders.QuadPart * di.TracksPerCylinder *
- di.SectorsPerTrack * di.BytesPerSector;
- }
- if (cmd == BLKGETSIZE)
- *(long *)buf = drive_size >> 9UL;
- else
- *(__off64_t *)buf = drive_size;
- return 0;
+ debug_printf ("BLKGETSIZE");
+ if (!DeviceIoControl (get_handle (),
+ IOCTL_DISK_GET_DRIVE_GEOMETRY,
+ NULL, 0,
+ &di, sizeof (di),
+ &bytes_read, NULL))
+ {
+ __seterrno ();
+ return -1;
+ }
+ debug_printf ("disk geometry: (%ld cyl)*(%ld trk)*(%ld sec)*(%ld bps)",
+ di.Cylinders.LowPart,
+ di.TracksPerCylinder,
+ di.SectorsPerTrack,
+ di.BytesPerSector);
+ if (DeviceIoControl (get_handle (),
+ IOCTL_DISK_GET_PARTITION_INFO,
+ NULL, 0,
+ &pi, sizeof (pi),
+ &bytes_read, NULL))
+ {
+ debug_printf ("partition info: %ld (%ld)",
+ pi.StartingOffset.LowPart,
+ pi.PartitionLength.LowPart);
+ drive_size = pi.PartitionLength.QuadPart;
+ }
+ else
+ {
+ drive_size = di.Cylinders.QuadPart * di.TracksPerCylinder *
+ di.SectorsPerTrack * di.BytesPerSector;
+ }
+ if (cmd == BLKGETSIZE)
+ *(long *)buf = drive_size >> 9UL;
+ else
+ *(__off64_t *)buf = drive_size;
+ return 0;
}
case BLKRRPART:
{
- debug_printf ("BLKRRPART");
- if (!DeviceIoControl (get_handle (),
- IOCTL_DISK_UPDATE_DRIVE_SIZE,
- NULL, 0,
- &di, sizeof (di),
- &bytes_read, NULL))
- {
- __seterrno ();
- return -1;
- }
- return 0;
+ debug_printf ("BLKRRPART");
+ if (!DeviceIoControl (get_handle (),
+ IOCTL_DISK_UPDATE_DRIVE_SIZE,
+ NULL, 0,
+ &di, sizeof (di),
+ &bytes_read, NULL))
+ {
+ __seterrno ();
+ return -1;
+ }
+ return 0;
}
case BLKSSZGET:
{
- debug_printf ("BLKSSZGET");
- if (!DeviceIoControl (get_handle (),
- IOCTL_DISK_GET_DRIVE_GEOMETRY,
- NULL, 0,
- &di, sizeof (di),
- &bytes_read, NULL))
- {
- __seterrno ();
- return -1;
- }
- debug_printf ("disk geometry: (%ld cyl)*(%ld trk)*(%ld sec)*(%ld bps)",
- di.Cylinders.LowPart,
- di.TracksPerCylinder,
- di.SectorsPerTrack,
- di.BytesPerSector);
- *(int *)buf = di.BytesPerSector;
- return 0;
+ debug_printf ("BLKSSZGET");
+ if (!DeviceIoControl (get_handle (),
+ IOCTL_DISK_GET_DRIVE_GEOMETRY,
+ NULL, 0,
+ &di, sizeof (di),
+ &bytes_read, NULL))
+ {
+ __seterrno ();
+ return -1;
+ }
+ debug_printf ("disk geometry: (%ld cyl)*(%ld trk)*(%ld sec)*(%ld bps)",
+ di.Cylinders.LowPart,
+ di.TracksPerCylinder,
+ di.SectorsPerTrack,
+ di.BytesPerSector);
+ *(int *)buf = di.BytesPerSector;
+ return 0;
}
default:
return fhandler_dev_raw::ioctl (cmd, buf);
diff --git a/winsup/cygwin/fhandler_socket.cc b/winsup/cygwin/fhandler_socket.cc
index 33e795458..30ff64cf9 100644
--- a/winsup/cygwin/fhandler_socket.cc
+++ b/winsup/cygwin/fhandler_socket.cc
@@ -1115,7 +1115,7 @@ fhandler_socket::ioctl (unsigned int cmd, void *p)
}
ifr->ifr_flags = IFF_NOTRAILERS | IFF_UP | IFF_RUNNING;
if (!strncmp(ifr->ifr_name, "lo", 2)
- || ntohl (((struct sockaddr_in *) &ifr->ifr_addr)->sin_addr.s_addr)
+ || ntohl (((struct sockaddr_in *) &ifr->ifr_addr)->sin_addr.s_addr)
== INADDR_LOOPBACK)
ifr->ifr_flags |= IFF_LOOPBACK;
else
diff --git a/winsup/cygwin/grp.cc b/winsup/cygwin/grp.cc
index dc93f913c..44abc9745 100644
--- a/winsup/cygwin/grp.cc
+++ b/winsup/cygwin/grp.cc
@@ -116,7 +116,7 @@ internal_getgrsid (cygsid &sid)
if (sid.string (sid_string))
for (int i = 0; i < gr.curr_lines; i++)
if (!strcmp (sid_string, group_buf[i].gr_passwd))
- return group_buf + i;
+ return group_buf + i;
return NULL;
}
@@ -244,9 +244,9 @@ internal_getgroups (int gidsetsize, __gid32_t *grouplist, cygsid * srchsid)
{
/* If impersonated, use impersonation token. */
if (cygheap->user.issetuid ())
- hToken = cygheap->user.token;
+ hToken = cygheap->user.token;
else if (!OpenProcessToken (hMainProc, TOKEN_QUERY, &hToken))
- hToken = NULL;
+ hToken = NULL;
}
if (hToken)
{
@@ -261,7 +261,7 @@ internal_getgroups (int gidsetsize, __gid32_t *grouplist, cygsid * srchsid)
cygsid sid;
if (srchsid)
- {
+ {
for (DWORD pg = 0; pg < groups->GroupCount; ++pg)
if (*srchsid == groups->Groups[pg].Sid)
return 1;
@@ -289,7 +289,7 @@ internal_getgroups (int gidsetsize, __gid32_t *grouplist, cygsid * srchsid)
else
debug_printf ("%d = GetTokenInformation(NULL) %E", size);
if (hToken != cygheap->user.token)
- CloseHandle (hToken);
+ CloseHandle (hToken);
if (cnt)
return cnt;
}
diff --git a/winsup/cygwin/net.cc b/winsup/cygwin/net.cc
index eabd1b375..99301e3d4 100644
--- a/winsup/cygwin/net.cc
+++ b/winsup/cygwin/net.cc
@@ -124,7 +124,7 @@ set_socket_inheritance (SOCKET sock)
SOCKET osock = sock;
if (!DuplicateHandle (hMainProc, (HANDLE) sock, hMainProc, (HANDLE *) &sock,
- 0, TRUE, DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE))
+ 0, TRUE, DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE))
system_printf ("DuplicateHandle failed %E");
else
debug_printf ("DuplicateHandle succeeded osock %p, sock %p", osock, sock);
@@ -153,7 +153,7 @@ extern "C" unsigned short
htons (unsigned short x)
{
return ((((x & 0x000000ffU) << 8) |
- ((x & 0x0000ff00U) >> 8)));
+ ((x & 0x0000ff00U) >> 8)));
}
/* ntohs: standards? */
diff --git a/winsup/cygwin/sec_acl.cc b/winsup/cygwin/sec_acl.cc
index ce3ad41bf..a7fc462a0 100644
--- a/winsup/cygwin/sec_acl.cc
+++ b/winsup/cygwin/sec_acl.cc
@@ -138,15 +138,15 @@ setacl (const char *file, int nentries, __aclent16_t *aclbufp)
*/
if (!(aclbufp[i].a_type & ACL_DEFAULT)
&& aclbufp[i].a_type & (USER|GROUP|OTHER_OBJ)
- && (pos = searchace (aclbufp + i + 1, nentries - i - 1,
+ && (pos = searchace (aclbufp + i + 1, nentries - i - 1,
aclbufp[i].a_type | ACL_DEFAULT,
(aclbufp[i].a_type & (USER|GROUP))
? aclbufp[i].a_id : -1)) >= 0
&& aclbufp[i].a_perm == aclbufp[pos].a_perm)
{
inheritance = SUB_CONTAINERS_AND_OBJECTS_INHERIT;
- /* This invalidates the corresponding default entry. */
- aclbufp[pos].a_type = USER|GROUP|ACL_DEFAULT;
+ /* This invalidates the corresponding default entry. */
+ aclbufp[pos].a_type = USER|GROUP|ACL_DEFAULT;
}
switch (aclbufp[i].a_type)
{
@@ -230,7 +230,7 @@ setacl (const char *file, int nentries, __aclent16_t *aclbufp)
static void
getace (__aclent16_t &acl, int type, int id, DWORD win_ace_mask,
- DWORD win_ace_type)
+ DWORD win_ace_type)
{
acl.a_type = type;
acl.a_id = id;
@@ -405,7 +405,7 @@ getacl (const char *file, DWORD attr, int nentries, __aclent16_t *aclbufp)
lacl[0].a_perm = lacl[1].a_perm;
if (pos > nentries)
{
- set_errno (ENOSPC);
+ set_errno (ENOSPC);
return -1;
}
memcpy (aclbufp, lacl, pos * sizeof (__aclent16_t));
diff --git a/winsup/cygwin/sec_helper.cc b/winsup/cygwin/sec_helper.cc
index f300398c7..86389da74 100644
--- a/winsup/cygwin/sec_helper.cc
+++ b/winsup/cygwin/sec_helper.cc
@@ -194,10 +194,10 @@ is_grp_member (__uid32_t uid, __gid32_t gid)
{
/* If gid == primary group of current user, return immediately. */
if (gid == myself->gid)
- return TRUE;
+ return TRUE;
/* Calling getgroups only makes sense when reading the access token. */
if (allow_ntsec)
- {
+ {
__gid32_t grps[NGROUPS_MAX];
int cnt = internal_getgroups (NGROUPS_MAX, grps);
for (idx = 0; idx < cnt; ++idx)
diff --git a/winsup/cygwin/security.cc b/winsup/cygwin/security.cc
index 6a15b6240..617ec4612 100644
--- a/winsup/cygwin/security.cc
+++ b/winsup/cygwin/security.cc
@@ -1243,8 +1243,8 @@ get_attribute_from_acl (int * attribute, PACL acl, PSID owner_sid,
| ((!(*anti & S_IWUSR)) ? S_IWUSR : 0);
if (ace->Mask & FILE_EXECUTE)
*flags |= ((!(*anti & S_IXOTH)) ? S_IXOTH : 0)
- | ((!(*anti & S_IXGRP)) ? S_IXGRP : 0)
- | ((!(*anti & S_IXUSR)) ? S_IXUSR : 0);
+ | ((!(*anti & S_IXGRP)) ? S_IXGRP : 0)
+ | ((!(*anti & S_IXUSR)) ? S_IXUSR : 0);
if ((*attribute & S_IFDIR) &&
(ace->Mask & (FILE_WRITE_DATA | FILE_EXECUTE | FILE_DELETE_CHILD))
== (FILE_WRITE_DATA | FILE_EXECUTE))
@@ -1374,7 +1374,7 @@ get_file_attribute (int use_ntsec, const char *file,
{
res = get_nt_attribute (file, attribute, uidret, gidret);
if (res)
- {
+ {
/* If reading the security descriptor failed, treat the file
as unreadable. */
*attribute &= ~(S_IRWXU | S_IRWXG | S_IRWXO);
diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc
index f50905cbd..dd7d26054 100644
--- a/winsup/cygwin/syscalls.cc
+++ b/winsup/cygwin/syscalls.cc
@@ -810,7 +810,7 @@ chown_worker (const char *name, unsigned fmode, __uid32_t uid, __gid32_t gid)
win32_path.get_win32 (),
(int *) &attrib);
if (!res)
- res = set_file_attribute (win32_path.has_acls (), win32_path, uid,
+ res = set_file_attribute (win32_path.has_acls (), win32_path, uid,
gid, attrib);
if (res != 0 && (!win32_path.has_acls () || !allow_ntsec))
{
diff --git a/winsup/cygwin/uinfo.cc b/winsup/cygwin/uinfo.cc
index bc1680374..82712d9d4 100644
--- a/winsup/cygwin/uinfo.cc
+++ b/winsup/cygwin/uinfo.cc
@@ -107,7 +107,7 @@ uinfo_init ()
if (!child_proc_info)
internal_getlogin (cygheap->user); /* Set the cygheap->user. */
else
- CloseHandle (cygheap->user.token);
+ CloseHandle (cygheap->user.token);
cygheap->user.set_orig_sid (); /* Update the original sid */
cygheap->user.token = INVALID_HANDLE_VALUE; /* No token present */
}
@@ -469,7 +469,10 @@ pwdgrp::load (const char *posix_fname)
HANDLE fh = CreateFile (pc, GENERIC_READ, wincap.shared (), NULL,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
if (fh == INVALID_HANDLE_VALUE)
- res = failed;
+ {
+ paranoid_printf ("%s CreateFile failed, %E");
+ res = failed;
+ }
else
{
DWORD size = GetFileSize (fh, NULL), read_bytes;
@@ -497,7 +500,7 @@ pwdgrp::load (const char *posix_fname)
}
}
- debug_printf ("load of %s %s", posix_fname, res);
+ debug_printf ("%s load %s", posix_fname, res);
initialized = true;
return;
}