Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
f1408b17
Unverified
Commit
f1408b17
authored
Oct 29, 2018
by
Salvatore Sanfilippo
Committed by
GitHub
Oct 29, 2018
Browse files
Merge pull request #5489 from devnexen/unstable
Fix non Linux build.
parents
b8febe60
ae3bfe58
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/server.c
View file @
f1408b17
...
@@ -1526,7 +1526,7 @@ void initServerConfig(void) {
...
@@ -1526,7 +1526,7 @@ void initServerConfig(void) {
server
.
runid
[
CONFIG_RUN_ID_SIZE
]
=
'\0'
;
server
.
runid
[
CONFIG_RUN_ID_SIZE
]
=
'\0'
;
changeReplicationId
();
changeReplicationId
();
clearReplicationId2
();
clearReplicationId2
();
server
.
timezone
=
t
ime
z
one
;
/* Initialized by tzset(). */
server
.
timezone
=
getT
ime
Z
one
()
;
/* Initialized by tzset(). */
server
.
configfile
=
NULL
;
server
.
configfile
=
NULL
;
server
.
executable
=
NULL
;
server
.
executable
=
NULL
;
server
.
config_hz
=
CONFIG_DEFAULT_HZ
;
server
.
config_hz
=
CONFIG_DEFAULT_HZ
;
...
...
src/util.c
View file @
f1408b17
...
@@ -39,6 +39,7 @@
...
@@ -39,6 +39,7 @@
#include <float.h>
#include <float.h>
#include <stdint.h>
#include <stdint.h>
#include <errno.h>
#include <errno.h>
#include <time.h>
#include "util.h"
#include "util.h"
#include "sha1.h"
#include "sha1.h"
...
@@ -652,6 +653,24 @@ sds getAbsolutePath(char *filename) {
...
@@ -652,6 +653,24 @@ sds getAbsolutePath(char *filename) {
return
abspath
;
return
abspath
;
}
}
/*
* Gets the proper timezone in a more portable fashion
* i.e timezone variables are linux specific.
*/
unsigned
long
getTimeZone
(
void
)
{
#ifdef __linux__
return
timezone
;
#else
struct
timeval
tv
;
struct
timezone
tz
;
gettimeofday
(
&
tv
,
&
tz
);
return
tz
.
tz_minuteswest
*
60UL
;
#endif
}
/* Return true if the specified path is just a file basename without any
/* Return true if the specified path is just a file basename without any
* relative or absolute path. This function just checks that no / or \
* relative or absolute path. This function just checks that no / or \
* character exists inside the specified path, that's enough in the
* character exists inside the specified path, that's enough in the
...
...
src/util.h
View file @
f1408b17
...
@@ -50,6 +50,7 @@ int string2ld(const char *s, size_t slen, long double *dp);
...
@@ -50,6 +50,7 @@ int string2ld(const char *s, size_t slen, long double *dp);
int
d2string
(
char
*
buf
,
size_t
len
,
double
value
);
int
d2string
(
char
*
buf
,
size_t
len
,
double
value
);
int
ld2string
(
char
*
buf
,
size_t
len
,
long
double
value
,
int
humanfriendly
);
int
ld2string
(
char
*
buf
,
size_t
len
,
long
double
value
,
int
humanfriendly
);
sds
getAbsolutePath
(
char
*
filename
);
sds
getAbsolutePath
(
char
*
filename
);
unsigned
long
getTimeZone
(
void
);
int
pathIsBaseName
(
char
*
path
);
int
pathIsBaseName
(
char
*
path
);
#ifdef REDIS_TEST
#ifdef REDIS_TEST
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment