Skip to content

Commit

Permalink
sysdig includes non-public parts of jq API draios#626
Browse files Browse the repository at this point in the history
  • Loading branch information
aleks-f committed Jul 28, 2016
1 parent 896b7a5 commit 4d6efe1
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 37 deletions.
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ script:
- cd jq-1.5
- ./configure --disable-maintainer-mode
- make LDFLAGS=-all-static
- sudo cp -r ./*.h /usr/local/include/
- sudo cp ./jq.h /usr/local/include/
- sudo cp ./jv.h /usr/local/include/
- sudo cp .libs/libjq.a /usr/local/lib/
- cd ..
- popd
Expand Down
34 changes: 0 additions & 34 deletions userspace/libsinsp/json_query.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,42 +24,8 @@
// jq is not C++-friendly
extern "C"
{
#include "compile.h"
#include "jv.h"
#include "jq.h"
//+++ jq C++ compile fixes
#ifndef NDEBUG
# define NDEBUG
# include "jv_alloc.h"
# undef NDEBUG
#else
# include "jv_alloc.h"
#endif // NDEBUG
#ifndef HAVE_MKSTEMP
# include <stdlib.h>
# include <fcntl.h>
inline int mkstemp(char *tpl)
{
size_t len = strlen(tpl);
int tries=5;
int fd;
// mktemp() truncates template when it fails
char *s = (char*)alloca(len + 1);
assert(s != NULL);
strcpy(s, tpl);
do
{
// Restore template
strcpy(tpl, s);
(void) mktemp(tpl);
fd = open(tpl, O_CREAT | O_EXCL | O_RDWR, 0600);
} while (fd == -1 && tries-- > 0);
return fd;
}
# define HAVE_MKSTEMP
#endif // HAVE_MKSTEMP
//--- jq C++ compile fix
#include "util.h"
}

#include <string>
Expand Down
4 changes: 2 additions & 2 deletions userspace/libsinsp/socket_handler.h
Original file line number Diff line number Diff line change
Expand Up @@ -606,8 +606,8 @@ class socket_data_handler
if(pass)
{
std::memset(buf, 0, size);
std::size_t pass_len = strlen((char*)pass);
if(size < (pass_len + 1)) { return 0; }
int pass_len = static_cast<int>(strlen((char*)pass));
if(size < (pass_len) + 1) { return 0; }
strncpy(buf, (const char*)pass, pass_len);
return pass_len;
}
Expand Down

0 comments on commit 4d6efe1

Please sign in to comment.