add some asserts to help static analyzers

From: Stefan Bühler <stbuehler@web.de>

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2957 152afb58-edef-0310-8abb-c4023f1b3aa9
svn/tags/lighttpd-1.4.35
Stefan Bühler 9 years ago
parent 326f2fb8a4
commit 7bd0f54ab2
  1. 1
      src/log.c
  2. 1
      src/mod_accesslog.c
  3. 1
      src/mod_secure_download.c
  4. 1
      src/server.c

@ -362,6 +362,7 @@ static void log_write(server *srv, buffer *b) {
case ERRORLOG_FILE:
case ERRORLOG_FD:
buffer_append_string_len(b, CONST_STR_LEN("\n"));
force_assert(b->used > 0);
write(srv->errorlog_fd, b->ptr, b->used - 1);
break;
case ERRORLOG_SYSLOG:

@ -915,6 +915,7 @@ REQUESTDONE_FUNC(log_access_write) {
}
#endif
} else if (p->conf.log_access_fd != -1) {
force_assert(b->used > 0);
write(p->conf.log_access_fd, b->ptr, b->used - 1);
}
buffer_reset(b);

@ -255,6 +255,7 @@ URIHANDLER_FUNC(mod_secdownload_uri_handler) {
buffer_copy_string_buffer(p->md5, p->conf.secret);
buffer_append_string(p->md5, rel_uri);
buffer_append_string_len(p->md5, ts_str, 8);
force_assert(p->md5->used > 0);
li_MD5_Init(&Md5Ctx);
li_MD5_Update(&Md5Ctx, (unsigned char *)p->md5->ptr, p->md5->used - 1);

@ -1001,6 +1001,7 @@ int main (int argc, char **argv) {
if (pid_fd != -1) {
buffer_copy_long(srv->tmp_buf, getpid());
buffer_append_string_len(srv->tmp_buf, CONST_STR_LEN("\n"));
force_assert(srv->tmp_buf->used > 0);
write(pid_fd, srv->tmp_buf->ptr, srv->tmp_buf->used - 1);
close(pid_fd);
pid_fd = -1;

Loading…
Cancel
Save