agent: add signal handlers
This commit is contained in:
11
agent/job.c
11
agent/job.c
@@ -104,17 +104,20 @@ void* get_os(void *args)
|
||||
system(cmd); /* TODO: set proper path */
|
||||
if ((fd = open(dump_path, O_RDONLY)) == -1) {
|
||||
fprintf(stderr, "Cannot open file: %s\n", dump_path);
|
||||
job->buf.meta.len = sprintf((char*)job->buf.chunk.data, "Unknown");
|
||||
SSL_write(job->ssl, &job->buf, sizeof(struct msg_t));
|
||||
job->buf.meta.len = sprintf((char*)job->buf.chunk.data,
|
||||
"I/O error");
|
||||
//SSL_write(job->ssl, &job->buf, sizeof(struct msg_t));
|
||||
} else {
|
||||
job->buf.meta.len = read(fd, job->buf.chunk.data, sizeof(job->buf.chunk.data));
|
||||
if ((signed)job->buf.meta.len == -1) {
|
||||
perror("Failed to read from file: ");
|
||||
}
|
||||
close(fd);
|
||||
SSL_write(job->ssl, &job->buf, sizeof(struct msg_t));
|
||||
job->slot = FREE;
|
||||
//SSL_write(job->ssl, &job->buf, sizeof(struct msg_t));
|
||||
//job->slot = FREE;
|
||||
}
|
||||
SSL_write(job->ssl, &job->buf, sizeof(struct msg_t));
|
||||
job->slot = FREE;
|
||||
unlink(dump_path);
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user