projects
/
citadel.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
19576ad
)
properly abort if we fail to create debug files instead of crashing.
author
Wilfried Goesgens
<dothebart@citadel.org>
Thu, 1 Jan 2015 15:36:50 +0000
(16:36 +0100)
committer
Wilfried Goesgens
<dothebart@citadel.org>
Thu, 1 Jan 2015 15:36:50 +0000
(16:36 +0100)
citadel/citserver.c
patch
|
blob
|
history
citadel/event_client.c
patch
|
blob
|
history
citadel/modules/eventclient/serv_eventclient.c
patch
|
blob
|
history
citadel/msgbase.c
patch
|
blob
|
history
citadel/sysdep.c
patch
|
blob
|
history
diff --git
a/citadel/citserver.c
b/citadel/citserver.c
index 18e0112487d70c1d98458a30c6536364714681a7..d0902e266985afbaf7e8cb1658507e3955ceef84 100644
(file)
--- a/
citadel/citserver.c
+++ b/
citadel/citserver.c
@@
-117,12
+117,25
@@
void master_startup(void) {
FILE *urandom;
struct ctdlroom qrbuf;
int rv;
FILE *urandom;
struct ctdlroom qrbuf;
int rv;
+ struct passwd *pw;
+ gid_t gid;
syslog(LOG_DEBUG, "master_startup() started\n");
time(&server_startup_time);
get_config();
syslog(LOG_DEBUG, "master_startup() started\n");
time(&server_startup_time);
get_config();
- syslog(LOG_INFO, "Opening databases\n");
+ syslog(LOG_INFO, "Checking directory access");
+ if ((pw = getpwuid(CTDLUID)) == NULL) {
+ gid = getgid();
+ } else {
+ gid = pw->pw_gid;
+ }
+
+ if (create_run_directories(CTDLUID, gid) != 0) {
+ syslog(LOG_EMERG, "failed to access & create directories");
+ exit(1);
+ }
+ syslog(LOG_INFO, "Opening databases");
open_databases();
check_ref_counts();
open_databases();
check_ref_counts();
diff --git
a/citadel/event_client.c
b/citadel/event_client.c
index 3e2cbdccaadea3eeb711acf13b2e2ceee6551ef1..999c9e4546c1b989efc6fb93c6f6ab8df8394b8f 100644
(file)
--- a/
citadel/event_client.c
+++ b/
citadel/event_client.c
@@
-26,6
+26,7
@@
#include "ctdl_module.h"
#include "event_client.h"
#include "ctdl_module.h"
#include "event_client.h"
+#include "citserver.h"
ConstStr IOStates[] = {
{HKEY("DB Queue")},
ConstStr IOStates[] = {
{HKEY("DB Queue")},
@@
-562,6
+563,11
@@
IO_send_callback(struct ev_loop *loop, ev_io *watcher, int revents)
IO->SendBuf.fd);
fd = fopen(fn, "a+");
IO->SendBuf.fd);
fd = fopen(fn, "a+");
+ if (fd == NULL) {
+ syslog(LOG_EMERG, "failed to open file %s: %s", fn, strerror(errno));
+ cit_backtrace();
+ exit(1);
+ }
fprintf(fd, "Send: BufSize: %ld BufContent: [",
nbytes);
rv = fwrite(pchh, nbytes, 1, fd);
fprintf(fd, "Send: BufSize: %ld BufContent: [",
nbytes);
rv = fwrite(pchh, nbytes, 1, fd);
@@
-885,6
+891,11
@@
IO_recv_callback(struct ev_loop *loop, ev_io *watcher, int revents)
IO->SendBuf.fd);
fd = fopen(fn, "a+");
IO->SendBuf.fd);
fd = fopen(fn, "a+");
+ if (fd == NULL) {
+ syslog(LOG_EMERG, "failed to open file %s: %s", fn, strerror(errno));
+ cit_backtrace();
+ exit(1);
+ }
fprintf(fd, "Read: BufSize: %ld BufContent: [",
nbytes);
rv = fwrite(pchh, nbytes, 1, fd);
fprintf(fd, "Read: BufSize: %ld BufContent: [",
nbytes);
rv = fwrite(pchh, nbytes, 1, fd);
diff --git
a/citadel/modules/eventclient/serv_eventclient.c
b/citadel/modules/eventclient/serv_eventclient.c
index d8c878309c67fcfe86a5a5cd0fdbe50fef550595..f7e286a9ab14cf6188f352b52ac036224df99982 100644
(file)
--- a/
citadel/modules/eventclient/serv_eventclient.c
+++ b/
citadel/modules/eventclient/serv_eventclient.c
@@
-126,7
+126,7
@@
gotstatus(int nnrun)
if (CURLMSG_DONE == msg->msg) {
CURL *chnd;
if (CURLMSG_DONE == msg->msg) {
CURL *chnd;
-
char
*chandle = NULL;
+
void
*chandle = NULL;
CURLcode sta;
CURLMcode msta;
AsyncIO*IO;
CURLcode sta;
CURLMcode msta;
AsyncIO*IO;
@@
-318,7
+318,7
@@
gotwatchsock(CURL *easy,
{
evcurl_global_data *global = cglobal;
CURLM *mhnd = global->mhnd;
{
evcurl_global_data *global = cglobal;
CURLM *mhnd = global->mhnd;
-
char
*f;
+
void
*f;
AsyncIO *IO = (AsyncIO*) vIO;
CURLcode sta;
const char *Action;
AsyncIO *IO = (AsyncIO*) vIO;
CURLcode sta;
const char *Action;
diff --git
a/citadel/msgbase.c
b/citadel/msgbase.c
index 95909e7cdbc682414a33904520215c34b925cbb0..135fe0e39b7f53c73882e3f0bbe46859ae4a054b 100644
(file)
--- a/
citadel/msgbase.c
+++ b/
citadel/msgbase.c
@@
-3264,6
+3264,11
@@
eReadState CtdlReadMessageBodyAsync(AsyncIO *IO)
IO->SendBuf.fd);
fd = fopen(fn, "a+");
IO->SendBuf.fd);
fd = fopen(fn, "a+");
+ if (fd == NULL) {
+ syslog(LOG_EMERG, "failed to open file %s: %s", fn, strerror(errno));
+ cit_backtrace();
+ exit(1);
+ }
#endif
ReadMsg = IO->ReadMsg;
#endif
ReadMsg = IO->ReadMsg;
@@
-3345,7
+3350,7
@@
eReadState CtdlReadMessageBodyAsync(AsyncIO *IO)
if (MsgFinished)
return eReadSuccess;
else
if (MsgFinished)
return eReadSuccess;
else
- return e
Abort
;
+ return e
ReadFail
;
}
}
diff --git
a/citadel/sysdep.c
b/citadel/sysdep.c
index 6f14ac4b17d948d02e2f85d46be187346fafb90a..19e5eb5ce7a5df1f1b219a801b270426b14e4325 100644
(file)
--- a/
citadel/sysdep.c
+++ b/
citadel/sysdep.c
@@
-405,14
+405,16
@@
int client_write(const char *buf, int nbytes)
snprintf(fn, SIZ, "/tmp/foolog_%s.%d", Ctx->ServiceName, Ctx->cs_pid);
fd = fopen(fn, "a+");
snprintf(fn, SIZ, "/tmp/foolog_%s.%d", Ctx->ServiceName, Ctx->cs_pid);
fd = fopen(fn, "a+");
- if (fd)
- {
- fprintf(fd, "Sending: BufSize: %d BufContent: [",
- nbytes);
- rv = fwrite(buf, nbytes, 1, fd);
- fprintf(fd, "]\n");
- fclose(fd);
+ if (fd == NULL) {
+ syslog(LOG_EMERG, "failed to open file %s: %s", fn, strerror(errno));
+ cit_backtrace();
+ exit(1);
}
}
+ fprintf(fd, "Sending: BufSize: %d BufContent: [",
+ nbytes);
+ rv = fwrite(buf, nbytes, 1, fd);
+ fprintf(fd, "]\n");
+ fclose(fd);
}
#endif
// flush_client_inbuf();
}
#endif
// flush_client_inbuf();
@@
-530,6
+532,11
@@
int client_read_blob(StrBuf *Target, int bytes, int timeout)
snprintf(fn, SIZ, "/tmp/foolog_%s.%d", CCC->ServiceName, CCC->cs_pid);
fd = fopen(fn, "a+");
snprintf(fn, SIZ, "/tmp/foolog_%s.%d", CCC->ServiceName, CCC->cs_pid);
fd = fopen(fn, "a+");
+ if (fd == NULL) {
+ syslog(LOG_EMERG, "failed to open file %s: %s", fn, strerror(errno));
+ cit_backtrace();
+ exit(1);
+ }
fprintf(fd, "Reading BLOB: BufSize: %d ",
bytes);
rv = fwrite(ChrPtr(Target), StrLength(Target), 1, fd);
fprintf(fd, "Reading BLOB: BufSize: %d ",
bytes);
rv = fwrite(ChrPtr(Target), StrLength(Target), 1, fd);
@@
-546,6
+553,11
@@
int client_read_blob(StrBuf *Target, int bytes, int timeout)
snprintf(fn, SIZ, "/tmp/foolog_%s.%d", CCC->ServiceName, CCC->cs_pid);
fd = fopen(fn, "a+");
snprintf(fn, SIZ, "/tmp/foolog_%s.%d", CCC->ServiceName, CCC->cs_pid);
fd = fopen(fn, "a+");
+ if (fd == NULL) {
+ syslog(LOG_EMERG, "failed to open file %s: %s", fn, strerror(errno));
+ cit_backtrace();
+ exit(1);
+ }
fprintf(fd, "Read: %d BufContent: [",
StrLength(Target));
rv = fwrite(ChrPtr(Target), StrLength(Target), 1, fd);
fprintf(fd, "Read: %d BufContent: [",
StrLength(Target));
rv = fwrite(ChrPtr(Target), StrLength(Target), 1, fd);
@@
-566,6
+578,11
@@
int client_read_blob(StrBuf *Target, int bytes, int timeout)
snprintf(fn, SIZ, "/tmp/foolog_%s.%d", CCC->ServiceName, CCC->cs_pid);
fd = fopen(fn, "a+");
snprintf(fn, SIZ, "/tmp/foolog_%s.%d", CCC->ServiceName, CCC->cs_pid);
fd = fopen(fn, "a+");
+ if (fd == NULL) {
+ syslog(LOG_EMERG, "failed to open file %s: %s", fn, strerror(errno));
+ cit_backtrace();
+ exit(1);
+ }
fprintf(fd, "Reading BLOB: BufSize: %d ",
bytes);
rv = fwrite(ChrPtr(Target), StrLength(Target), 1, fd);
fprintf(fd, "Reading BLOB: BufSize: %d ",
bytes);
rv = fwrite(ChrPtr(Target), StrLength(Target), 1, fd);
@@
-591,6
+608,11
@@
int client_read_blob(StrBuf *Target, int bytes, int timeout)
snprintf(fn, SIZ, "/tmp/foolog_%s.%d", CCC->ServiceName, CCC->cs_pid);
fd = fopen(fn, "a+");
snprintf(fn, SIZ, "/tmp/foolog_%s.%d", CCC->ServiceName, CCC->cs_pid);
fd = fopen(fn, "a+");
+ if (fd == NULL) {
+ syslog(LOG_EMERG, "failed to open file %s: %s", fn, strerror(errno));
+ cit_backtrace();
+ exit(1);
+ }
fprintf(fd, "Read: %d BufContent: [",
StrLength(Target));
rv = fwrite(ChrPtr(Target), StrLength(Target), 1, fd);
fprintf(fd, "Read: %d BufContent: [",
StrLength(Target));
rv = fwrite(ChrPtr(Target), StrLength(Target), 1, fd);
@@
-645,6
+667,11
@@
int client_read_random_blob(StrBuf *Target, int timeout)
snprintf(fn, SIZ, "/tmp/foolog_%s.%d", CCC->ServiceName, CCC->cs_pid);
fd = fopen(fn, "a+");
snprintf(fn, SIZ, "/tmp/foolog_%s.%d", CCC->ServiceName, CCC->cs_pid);
fd = fopen(fn, "a+");
+ if (fd == NULL) {
+ syslog(LOG_EMERG, "failed to open file %s: %s", fn, strerror(errno));
+ cit_backtrace();
+ exit(1);
+ }
fprintf(fd, "Read: BufSize: %d BufContent: [",
StrLength(Target));
rv = fwrite(ChrPtr(Target), StrLength(Target), 1, fd);
fprintf(fd, "Read: BufSize: %d BufContent: [",
StrLength(Target));
rv = fwrite(ChrPtr(Target), StrLength(Target), 1, fd);
@@
-728,6
+755,11
@@
int CtdlClientGetLine(StrBuf *Target)
snprintf(fn, SIZ, "/tmp/foolog_%s.%d", CCC->ServiceName, CCC->cs_pid);
fd = fopen(fn, "a+");
snprintf(fn, SIZ, "/tmp/foolog_%s.%d", CCC->ServiceName, CCC->cs_pid);
fd = fopen(fn, "a+");
+ if (fd == NULL) {
+ syslog(LOG_EMERG, "failed to open file %s: %s", fn, strerror(errno));
+ cit_backtrace();
+ exit(1);
+ }
pch = ChrPtr(CCC->RecvBuf.Buf);
len = StrLength(CCC->RecvBuf.Buf);
if (CCC->RecvBuf.ReadWritePointer != NULL)
pch = ChrPtr(CCC->RecvBuf.Buf);
len = StrLength(CCC->RecvBuf.Buf);
if (CCC->RecvBuf.ReadWritePointer != NULL)
@@
-781,6
+813,11
@@
int CtdlClientGetLine(StrBuf *Target)
snprintf(fn, SIZ, "/tmp/foolog_%s.%d", CCC->ServiceName, CCC->cs_pid);
fd = fopen(fn, "a+");
snprintf(fn, SIZ, "/tmp/foolog_%s.%d", CCC->ServiceName, CCC->cs_pid);
fd = fopen(fn, "a+");
+ if (fd == NULL) {
+ syslog(LOG_EMERG, "failed to open file %s: %s", fn, strerror(errno));
+ cit_backtrace();
+ exit(1);
+ }
pch = ChrPtr(CCC->RecvBuf.Buf);
len = StrLength(CCC->RecvBuf.Buf);
if (CCC->RecvBuf.ReadWritePointer != NULL)
pch = ChrPtr(CCC->RecvBuf.Buf);
len = StrLength(CCC->RecvBuf.Buf);
if (CCC->RecvBuf.ReadWritePointer != NULL)