Skip to content
This repository has been archived by the owner on Nov 9, 2021. It is now read-only.

Commit

Permalink
Merged PR 2752: Use fstat64 if available #gh59
Browse files Browse the repository at this point in the history
Use fstat64 if available on solaris #gh59

Related work items: #117374
  • Loading branch information
RBoulton-BT authored and dmorash-BT committed Oct 24, 2017
1 parent f78c1ec commit 37c7070
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
9 changes: 9 additions & 0 deletions lwmsg/MakeKitBuild
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,15 @@ configure()
mk_define SOLARIS_11 1
fi

# Temporary check for transitional lf64 calls
# Solaris only; attempting to determine cause of Github issue 59
if [ "$MK_HOST_OS" = "solaris" ]
then
mk_check_functions \
HEADERDEPS="sys/stat.h" \
fstat64
fi

mk_multiarch_do
mk_define "MOD_EXT" "${MK_DLO_EXT}"
mk_check_endian
Expand Down
16 changes: 12 additions & 4 deletions lwmsg/src/connection-wire.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,14 @@
# define CMSG_LEN(len) (CMSG_ALIGN(sizeof(struct cmsghdr)) + (len))
#endif

#ifdef HAVE_FSTAT64
# define FSTAT fstat64
# define FSTAT_BUF struct stat64
#else
# define FSTAT fstat
# define FSTAT_BUF struct stat
#endif

static void
lwmsg_connection_packet_ntoh(ConnectionPacket* packet)
{
Expand Down Expand Up @@ -1166,11 +1174,11 @@ lwmsg_connection_finish_recv_connect(
/* Otherwise, use the explicit auth method */
if (packet->contents.greeting.flags & CONNECTION_GREETING_AUTH_LOCAL)
{
struct stat statbuf;
FSTAT_BUF statbuf;

BAIL_ON_ERROR(status = lwmsg_connection_dequeue_fd(assoc, &fd));

if (fstat(fd, &statbuf))
if (FSTAT(fd, &statbuf))
{
BAIL_ON_ERROR(status = RAISE_ERRNO(&assoc->context));
}
Expand Down Expand Up @@ -1398,11 +1406,11 @@ lwmsg_connection_finish_recv_accept(
/* Otherwise, use the explicit auth method */
if (packet->contents.greeting.flags & CONNECTION_GREETING_AUTH_LOCAL)
{
struct stat statbuf;
FSTAT_BUF statbuf;

BAIL_ON_ERROR(status = lwmsg_connection_dequeue_fd(assoc, &fd));

if (fstat(fd, &statbuf))
if (FSTAT(fd, &statbuf))
{
BAIL_ON_ERROR(status = RAISE_ERRNO(&assoc->context));
}
Expand Down

0 comments on commit 37c7070

Please sign in to comment.