fix minor compile warnings

pull/137/head
Oliver Giles 4 years ago
parent 09a208ebeb
commit d6be7f5079

@ -195,7 +195,7 @@ int main(int argc, char** argv) {
return EXIT_BAD_ARGUMENT;
}
if(char* pipeNum = getenv("__LAMINAR_SETENV_PIPE")) {
write(atoi(pipeNum), argv[2], strlen(argv[2]));
LSYSCALL(write(atoi(pipeNum), argv[2], strlen(argv[2])));
} else {
fprintf(stderr, "Must be run from within a laminar job\n");
return EXIT_BAD_ARGUMENT;

@ -780,7 +780,7 @@ bool Laminar::handleBadgeRequest(std::string job, std::string &badge) {
const char* gradient1 = (rs == RunState::SUCCESS) ? "#2aff4d" : "#ff2a2a";
const char* gradient2 = (rs == RunState::SUCCESS) ? "#24b43c" : "#b42424";
char* svg = NULL;
asprintf(&svg,
if(asprintf(&svg,
R"x(
<svg xmlns="http://www.w3.org/2000/svg" width="%d" height="20">
<clipPath id="clip">
@ -800,7 +800,9 @@ R"x(
<rect x="%d" width="%d" height="20" fill="url(#status)"/>
<text x="%d" y="14" fill="#000">%s</text>
</g>
</svg>)x", jobNameWidth+statusWidth, jobNameWidth+statusWidth, gradient1, gradient2, jobNameWidth, jobNameWidth/2+1, job.data(), jobNameWidth, statusWidth, jobNameWidth+statusWidth/2, status.data());
</svg>)x", jobNameWidth+statusWidth, jobNameWidth+statusWidth, gradient1, gradient2, jobNameWidth, jobNameWidth/2+1, job.data(), jobNameWidth, statusWidth, jobNameWidth+statusWidth/2, status.data()) < 0)
return false;
badge = svg;
return true;
}

@ -1,5 +1,5 @@
///
/// Copyright 2019 Oliver Giles
/// Copyright 2019-2020 Oliver Giles
///
/// This file is part of Laminar
///
@ -89,7 +89,7 @@ Leader::Leader(kj::AsyncIoContext &ioContext, kj::Filesystem &fs, const char *jo
});
}));
pipe(setEnvPipe);
LSYSCALL(pipe(setEnvPipe));
auto event = ioContext.lowLevelProvider->wrapInputFd(setEnvPipe[0], kj::LowLevelAsyncIoProvider::TAKE_OWNERSHIP);
auto buffer = kj::heapArrayBuilder<char>(1024);
tasks.add(readEnvPipe(event, buffer.asPtr().begin()).attach(kj::mv(event), kj::mv(buffer)));

@ -1,5 +1,5 @@
///
/// Copyright 2015-2018 Oliver Giles
/// Copyright 2015-2020 Oliver Giles
///
/// This file is part of Laminar
///
@ -152,8 +152,8 @@ kj::Promise<RunState> Run::start(uint buildNum, std::shared_ptr<Context> ctx, co
// enough. Instead, we'll just exec ourselves and handle that in laminard's
// main() by calling leader_main()
char* procName;
asprintf(&procName, "{laminar} %s:%d", name.data(), buildNum);
execl("/proc/self/exe", procName, NULL); // does not return
if(asprintf(&procName, "{laminar} %s:%d", name.data(), buildNum) > 0)
execl("/proc/self/exe", procName, NULL); // does not return
_exit(EXIT_FAILURE);
}

@ -1,5 +1,5 @@
///
/// Copyright 2019 Oliver Giles
/// Copyright 2019-2020 Oliver Giles
///
/// This file is part of Laminar
///
@ -19,15 +19,17 @@
#ifndef LAMINAR_FIXTURE_H_
#define LAMINAR_FIXTURE_H_
#include <capnp/rpc-twoparty.h>
#include <gtest/gtest.h>
#include "laminar.capnp.h"
#include "eventsource.h"
#include "tempdir.h"
#include "laminar.h"
#include "log.h"
#include "server.h"
#include "conf.h"
#include <capnp/rpc-twoparty.h>
#include <gtest/gtest.h>
class LaminarFixture : public ::testing::Test {
public:
LaminarFixture() {
@ -108,7 +110,7 @@ public:
StringMap parseFromString(kj::StringPtr content) {
char tmp[16] = "/tmp/lt.XXXXXX";
int fd = mkstemp(tmp);
write(fd, content.begin(), content.size());
LSYSCALL(write(fd, content.begin(), content.size()));
close(fd);
StringMap map = parseConfFile(tmp);
unlink(tmp);

@ -1,5 +1,5 @@
///
/// Copyright 2018 Oliver Giles
/// Copyright 2018-2020 Oliver Giles
///
/// This file is part of Laminar
///
@ -19,6 +19,8 @@
#ifndef LAMINAR_TEMPDIR_H_
#define LAMINAR_TEMPDIR_H_
#include "log.h"
#include <kj/filesystem.h>
#include <stdlib.h>
@ -37,7 +39,7 @@ public:
private:
static kj::Path mkdtemp() {
char dir[] = "/tmp/laminar-test-XXXXXX";
::mkdtemp(dir);
LASSERT(::mkdtemp(dir) != nullptr, "mkdtemp failed");
return kj::Path::parse(&dir[1]);
}
};

@ -1,5 +1,5 @@
///
/// Copyright 2018 Oliver Giles
/// Copyright 2018-2020 Oliver Giles
///
/// This file is part of Laminar
///
@ -16,8 +16,9 @@
/// You should have received a copy of the GNU General Public License
/// along with Laminar. If not, see <http://www.gnu.org/licenses/>
///
#include <gtest/gtest.h>
#include "conf.h"
#include "log.h"
#include <gtest/gtest.h>
class ConfTest : public ::testing::Test {
protected:
@ -30,7 +31,7 @@ protected:
}
void parseConf(std::string conf) {
lseek(fd, SEEK_SET, 0);
write(fd, conf.data(), conf.size());
LSYSCALL(write(fd, conf.data(), conf.size()));
cfg = parseConfFile(tmpFile);
}
StringMap cfg;

Loading…
Cancel
Save