mirror of
https://github.com/bdnugget/kcgi.git
synced 2026-11-07 05:47:27 +00:00
Rename sun -> un so as not to trample SunOS macro. Don't use LOG_PERROR if
it doesn't exist. Don't use sun_len if it doesn't exist.
This commit is contained in:
1 parent
d45a63c9c1
commit
a395446859
4 files changed
+27
-25
No files matched your search
@@ -32,7 +32,7 @@
|
||||
#include "extern.h"
|
||||
|
||||
#define MD5Updatec(_ctx, _b, _sz) \
|
||||
MD5Update((_ctx), (const u_int8_t *)(_b), (_sz))
|
||||
MD5Update((_ctx), (const uint8_t *)(_b), (_sz))
|
||||
|
||||
static const char b64[] =
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
#include "extern.h"
|
||||
|
||||
#define MD5Updatec(_ctx, _b, _sz) \
|
||||
MD5Update((_ctx), (const u_int8_t *)(_b), (_sz))
|
||||
MD5Update((_ctx), (const uint8_t *)(_b), (_sz))
|
||||
|
||||
/*
|
||||
* For handling HTTP multipart forms.
|
||||
|
||||
+10
-10
@@ -641,7 +641,7 @@ dochild_fcgi(kcgi_regress_server child, void *carg)
|
||||
int in, rc = 0, fd;
|
||||
size_t sz, len, vecsz = 0, headsz;
|
||||
pid_t pid;
|
||||
struct sockaddr_un sun;
|
||||
struct sockaddr_un un;
|
||||
struct sockaddr *ss;
|
||||
ssize_t ssz;
|
||||
extern char *__progname;
|
||||
@@ -673,22 +673,22 @@ dochild_fcgi(kcgi_regress_server child, void *carg)
|
||||
|
||||
/* Do the usual dance to set up UNIX sockets. */
|
||||
|
||||
ss = (struct sockaddr *)&sun;
|
||||
memset(&sun, 0, sizeof(sun));
|
||||
sun.sun_family = AF_UNIX;
|
||||
sz = strlcpy(sun.sun_path, sfn, sizeof(sun.sun_path));
|
||||
if (sz >= sizeof(sun.sun_path)) {
|
||||
ss = (struct sockaddr *)&un;
|
||||
memset(&un, 0, sizeof(un));
|
||||
un.sun_family = AF_UNIX;
|
||||
sz = strlcpy(un.sun_path, sfn, sizeof(un.sun_path));
|
||||
if (sz >= sizeof(un.sun_path)) {
|
||||
fprintf(stderr, "socket path to long\n");
|
||||
return 0;
|
||||
}
|
||||
#ifndef __linux__
|
||||
sun.sun_len = sz;
|
||||
#if !defined(__linux__) && !defined(__sun)
|
||||
un.sun_len = sz;
|
||||
#endif
|
||||
|
||||
if ((fd = socket(AF_UNIX, SOCK_STREAM, 0)) == -1) {
|
||||
perror("socket");
|
||||
return 0;
|
||||
} else if (bind(fd, ss, sizeof(sun)) == -1) {
|
||||
} else if (bind(fd, ss, sizeof(un)) == -1) {
|
||||
perror(sfn);
|
||||
close(fd);
|
||||
return 0;
|
||||
@@ -740,7 +740,7 @@ dochild_fcgi(kcgi_regress_server child, void *carg)
|
||||
if ((fd = socket(AF_UNIX, SOCK_STREAM, 0)) == -1) {
|
||||
perror(sfn);
|
||||
goto out;
|
||||
} else if (connect(fd, ss, sizeof(sun)) == -1) {
|
||||
} else if (connect(fd, ss, sizeof(un)) == -1) {
|
||||
perror(sfn);
|
||||
goto out;
|
||||
} else if (unlink(sfn) == -1) {
|
||||
|
||||
@@ -878,13 +878,13 @@ out:
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
int c, fd, varp, usemax, useq, nod;
|
||||
int c, fd, varp, usemax, useq, nod, logop;
|
||||
struct passwd *pw;
|
||||
size_t i, wsz, sz, lsz, maxwsz;
|
||||
time_t waittime;
|
||||
const char *pname, *sockpath, *chpath,
|
||||
*sockuser, *procuser, *errstr;
|
||||
struct sockaddr_un sun;
|
||||
struct sockaddr_un un;
|
||||
mode_t old_umask;
|
||||
uid_t sockuid, procuid;
|
||||
gid_t sockgid, procgid;
|
||||
@@ -1006,15 +1006,15 @@ main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
/* Do the usual dance to set up UNIX sockets. */
|
||||
memset(&sun, 0, sizeof(sun));
|
||||
sun.sun_family = AF_UNIX;
|
||||
sz = strlcpy(sun.sun_path, sockpath, sizeof(sun.sun_path));
|
||||
if (sz >= sizeof(sun.sun_path)) {
|
||||
memset(&un, 0, sizeof(un));
|
||||
un.sun_family = AF_UNIX;
|
||||
sz = strlcpy(un.sun_path, sockpath, sizeof(un.sun_path));
|
||||
if (sz >= sizeof(un.sun_path)) {
|
||||
fprintf(stderr, "socket path to long\n");
|
||||
return(EXIT_FAILURE);
|
||||
}
|
||||
#ifndef __linux__
|
||||
sun.sun_len = sz;
|
||||
#if !defined(__linux__) && !defined(__sun)
|
||||
un.sun_len = sz;
|
||||
#endif
|
||||
|
||||
/*
|
||||
@@ -1040,7 +1040,7 @@ main(int argc, char *argv[])
|
||||
* If necessary, change the file's ownership.
|
||||
* We buffer up to the number of available workers.
|
||||
*/
|
||||
if (-1 == bind(fd, (struct sockaddr *)&sun, sizeof(sun))) {
|
||||
if (-1 == bind(fd, (struct sockaddr *)&un, sizeof(un))) {
|
||||
perror("bind");
|
||||
close(fd);
|
||||
return(EXIT_FAILURE);
|
||||
@@ -1108,11 +1108,13 @@ main(int argc, char *argv[])
|
||||
free(nargv);
|
||||
return(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
|
||||
logop = LOG_PID;
|
||||
#ifdef LOG_PERROR
|
||||
if (nod)
|
||||
openlog(pname, LOG_PERROR | LOG_PID, LOG_DAEMON);
|
||||
else
|
||||
openlog(pname, LOG_PID, LOG_DAEMON);
|
||||
logop |= LOG_PERROR;
|
||||
#endif
|
||||
openlog(pname, logop, LOG_DAEMON);
|
||||
|
||||
c = varp ?
|
||||
varpool(wsz, maxwsz, waittime, fd, sockpath, nargv) :
|
||||
|
||||
Reference in new issue
Block a user