Add proper build date + fix some warnings
This commit is contained in:
parent
357d57b95e
commit
fdd2d0ccdf
@ -19,7 +19,6 @@ ENDMACRO(ADD_TARGET_PROPERTIES)
|
|||||||
|
|
||||||
PROJECT(spawn-fcgi)
|
PROJECT(spawn-fcgi)
|
||||||
SET(PACKAGE_VERSION 2.0.0)
|
SET(PACKAGE_VERSION 2.0.0)
|
||||||
EXEC_PROGRAM(date ARGS "'+%b %d %Y %H:%M:%S UTC'" OUTPUT_VARIABLE PACKAGE_BUILD_DATE)
|
|
||||||
OPTION(USE_LIMITS "Enable /etc/security/limits.conf support" ON)
|
OPTION(USE_LIMITS "Enable /etc/security/limits.conf support" ON)
|
||||||
IF("${CMAKE_BUILD_TYPE}" STREQUAL "")
|
IF("${CMAKE_BUILD_TYPE}" STREQUAL "")
|
||||||
SET(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel." FORCE)
|
SET(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel." FORCE)
|
||||||
|
@ -275,8 +275,8 @@ process_limit (int source, const char *lim_type,
|
|||||||
|
|
||||||
static gboolean pam_modutil_user_in_group_nam_nam(struct passwd *pwd, const char *group) {
|
static gboolean pam_modutil_user_in_group_nam_nam(struct passwd *pwd, const char *group) {
|
||||||
struct group *grp;
|
struct group *grp;
|
||||||
grp = getgrnam(group);
|
|
||||||
size_t i;
|
size_t i;
|
||||||
|
grp = getgrnam(group);
|
||||||
|
|
||||||
if (pwd == NULL || grp == NULL) return FALSE;
|
if (pwd == NULL || grp == NULL) return FALSE;
|
||||||
if (pwd->pw_gid == grp->gr_gid) return TRUE;
|
if (pwd->pw_gid == grp->gr_gid) return TRUE;
|
||||||
@ -415,6 +415,7 @@ static int setup_limits(struct pam_limit_s *pl) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* now the session stuff */
|
/* now the session stuff */
|
||||||
|
int pam_set_limits(const char *conf_file, const char *username);
|
||||||
int pam_set_limits(const char *conf_file, const char *username) {
|
int pam_set_limits(const char *conf_file, const char *username) {
|
||||||
int retval;
|
int retval;
|
||||||
struct pam_limit_s pl;
|
struct pam_limit_s pl;
|
||||||
|
24
spawn-fcgi.c
24
spawn-fcgi.c
@ -130,7 +130,7 @@ static options opts = {
|
|||||||
static struct data data;
|
static struct data data;
|
||||||
|
|
||||||
/* only require an entry for name != NULL, otherwise a id as key is ok */
|
/* only require an entry for name != NULL, otherwise a id as key is ok */
|
||||||
int readpwdent(gchar *key, uid_t *uid, gid_t *gid, gchar** name) {
|
static int readpwdent(gchar *key, uid_t *uid, gid_t *gid, gchar** name) {
|
||||||
struct passwd *pwd;
|
struct passwd *pwd;
|
||||||
errno = 0;
|
errno = 0;
|
||||||
*gid = (gid_t) -1;
|
*gid = (gid_t) -1;
|
||||||
@ -145,7 +145,7 @@ int readpwdent(gchar *key, uid_t *uid, gid_t *gid, gchar** name) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int readgrpent(gchar *key, gid_t *gid) {
|
static int readgrpent(gchar *key, gid_t *gid) {
|
||||||
struct group *grp;
|
struct group *grp;
|
||||||
errno = 0;
|
errno = 0;
|
||||||
if (NULL == (grp = getgrnam(key)) && NULL == (grp = getgrgid(atoi(key)))) {
|
if (NULL == (grp = getgrnam(key)) && NULL == (grp = getgrgid(atoi(key)))) {
|
||||||
@ -157,7 +157,7 @@ int readgrpent(gchar *key, gid_t *gid) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int create_sockaddr() {
|
static int create_sockaddr() {
|
||||||
if (opts.addr != 0 && opts.port == 0) {
|
if (opts.addr != 0 && opts.port == 0) {
|
||||||
g_printerr("Specified address without port\n");
|
g_printerr("Specified address without port\n");
|
||||||
return -1;
|
return -1;
|
||||||
@ -196,7 +196,7 @@ int create_sockaddr() {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int bind_socket() {
|
static int bind_socket() {
|
||||||
int s, val;
|
int s, val;
|
||||||
|
|
||||||
/* Check if socket is already open */
|
/* Check if socket is already open */
|
||||||
@ -264,7 +264,7 @@ int bind_socket() {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int open_pidfile() {
|
static int open_pidfile() {
|
||||||
if (opts.pid_file) {
|
if (opts.pid_file) {
|
||||||
struct stat st;
|
struct stat st;
|
||||||
if (0 == (data.pid_fd = open(opts.pid_file, O_WRONLY | O_CREAT | O_EXCL | O_TRUNC, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH))) {
|
if (0 == (data.pid_fd = open(opts.pid_file, O_WRONLY | O_CREAT | O_EXCL | O_TRUNC, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH))) {
|
||||||
@ -294,7 +294,7 @@ int open_pidfile() {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void prepare_env() {
|
static void prepare_env() {
|
||||||
GString *tmp;
|
GString *tmp;
|
||||||
if (-1 != opts.php_childs) {
|
if (-1 != opts.php_childs) {
|
||||||
tmp = g_string_sized_new(0);
|
tmp = g_string_sized_new(0);
|
||||||
@ -304,7 +304,7 @@ void prepare_env() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int drop_priv() {
|
static int drop_priv() {
|
||||||
if (data.i_am_root) {
|
if (data.i_am_root) {
|
||||||
/* set user and group */
|
/* set user and group */
|
||||||
|
|
||||||
@ -368,7 +368,7 @@ int drop_priv() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* move a fd to another and close the old one */
|
/* move a fd to another and close the old one */
|
||||||
void move2fd(int srcfd, int dstfd) {
|
static void move2fd(int srcfd, int dstfd) {
|
||||||
if (srcfd != dstfd) {
|
if (srcfd != dstfd) {
|
||||||
close(dstfd);
|
close(dstfd);
|
||||||
dup2(srcfd, dstfd);
|
dup2(srcfd, dstfd);
|
||||||
@ -377,11 +377,11 @@ void move2fd(int srcfd, int dstfd) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* replace an fd with /dev/null */
|
/* replace an fd with /dev/null */
|
||||||
void move2devnull(int fd) {
|
static void move2devnull(int fd) {
|
||||||
move2fd(open("/dev/null", O_RDWR), fd);
|
move2fd(open("/dev/null", O_RDWR), fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
pid_t daemonize() {
|
static pid_t daemonize() {
|
||||||
pid_t child;
|
pid_t child;
|
||||||
int status;
|
int status;
|
||||||
struct timeval tv = { 0, 100 * 1000 };
|
struct timeval tv = { 0, 100 * 1000 };
|
||||||
@ -451,7 +451,7 @@ void start() {
|
|||||||
exit(errno);
|
exit(errno);
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean option_parse_address(const gchar *option_name, const gchar *value, gpointer d, GError **error) {
|
static gboolean option_parse_address(const gchar *option_name, const gchar *value, gpointer d, GError **error) {
|
||||||
UNUSED(option_name);
|
UNUSED(option_name);
|
||||||
UNUSED(d);
|
UNUSED(d);
|
||||||
UNUSED(error);
|
UNUSED(error);
|
||||||
@ -514,7 +514,7 @@ int main(int argc, char **argv) {
|
|||||||
|
|
||||||
if (opts.show_version) {
|
if (opts.show_version) {
|
||||||
g_printerr(PACKAGE_NAME "-" PACKAGE_VERSION " - spawns fastcgi processes\n");
|
g_printerr(PACKAGE_NAME "-" PACKAGE_VERSION " - spawns fastcgi processes\n");
|
||||||
g_printerr("Build: " PACKAGE_BUILD_DATE "\n");
|
g_printerr("Build-Date: " __DATE__ " " __TIME__ "\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user