Skip to content

Commit c2151fa

Browse files
author
Pekka Nousiainen
committed
bug#20095208 - UNABLE TO STORE FRAGMENT DURING LCP. NDBFS ERROR: 2812 - DBLQH (LINE: 14305)
Including EventLogger.hpp via ndb_socket.h caused unrelated link problem on Solaris (missing symbols in Parser-t). Move implementation of my_socket_close to ndb_socket.cpp.
1 parent b9a4337 commit c2151fa

File tree

2 files changed

+35
-19
lines changed

2 files changed

+35
-19
lines changed

storage/ndb/include/portlib/ndb_socket_posix.h

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,6 @@
2323
#include <sys/types.h>
2424
#include <sys/socket.h>
2525
#include <netinet/in.h>
26-
#include <sys/stat.h>
27-
#include <EventLogger.hpp>
28-
29-
extern EventLogger* g_eventLogger;
3026

3127
#define MY_SOCKET_FORMAT "%d"
3228
#define MY_SOCKET_FORMAT_VALUE(x) (x.fd)
@@ -63,20 +59,8 @@ static inline int my_socket_get_fd(ndb_socket_t s)
6359
return s.fd;
6460
}
6561

66-
static inline int my_socket_close(ndb_socket_t s)
67-
{
68-
struct stat sb;
69-
if (fstat(s.fd, &sb) == 0)
70-
{
71-
if ((sb.st_mode & S_IFMT) != S_IFSOCK)
72-
{
73-
g_eventLogger->error("fd=%d: not socket: mode=%o",
74-
s.fd, sb.st_mode);
75-
abort();
76-
}
77-
}
78-
return close(s.fd);
79-
}
62+
/* implemented in ndb_socket.cpp */
63+
extern int my_socket_close(ndb_socket_t s);
8064

8165
static inline int my_socket_errno()
8266
{

storage/ndb/src/common/portlib/ndb_socket.cpp

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
2+
Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved.
33
44
This program is free software; you can redistribute it and/or modify
55
it under the terms of the GNU General Public License as published by
@@ -19,6 +19,38 @@
1919
#include "m_string.h"
2020
#include "ndb_socket.h"
2121

22+
/*
23+
Implement my_socket_close here to avoid EventLogger.hpp in
24+
header file (causes unrelated link problem on Solaris).
25+
*/
26+
27+
#if defined _WIN32
28+
29+
/* skip */
30+
31+
#else
32+
33+
#include <sys/stat.h>
34+
#include <EventLogger.hpp>
35+
36+
extern EventLogger* g_eventLogger;
37+
38+
int my_socket_close(ndb_socket_t s)
39+
{
40+
struct stat sb;
41+
if (fstat(s.fd, &sb) == 0)
42+
{
43+
if ((sb.st_mode & S_IFMT) != S_IFSOCK)
44+
{
45+
g_eventLogger->error("fd=%d: not socket: mode=%o",
46+
s.fd, sb.st_mode);
47+
abort();
48+
}
49+
}
50+
return close(s.fd);
51+
}
52+
53+
#endif
2254

2355
/*
2456
Implement my_socketpair() so that it works both on UNIX and windows

0 commit comments

Comments
 (0)