fix: working on linux

This commit is contained in:
elvis
2022-04-11 19:19:17 +02:00
parent 79259a15b7
commit a7a0027f86
3 changed files with 10 additions and 6 deletions

View File

@ -1,8 +1,9 @@
#define _POSIX_C_SOURCE 200112L
#include <time.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <time.h>
#include <errno.h>
#include <pthread.h>

View File

@ -1,5 +1,7 @@
#include <strings.h>
#define _POSIX_C_SOURCE 200809L
#include <string.h>
#include <errno.h>
#include <inttypes.h>
#include <conn.h>
#include <apiFile.h>
@ -103,7 +105,7 @@ int sendFile(fileT *f, long fd_c, taglia_t *taglia) {
int n = 0;
size_t m = sizeof(tmp_log);
n += snprintf(tmp_log+n, m-n, "File \"%s\", di dimensione %llu Bytes al client %ld .\n", f->filepath, validLength, fd_c);
n += snprintf(tmp_log+n, m-n, "File \"%s\", di dimensione %"PRId64" Bytes al client %ld .\n", f->filepath, validLength, fd_c);
if(taglia_write(taglia, tmp_log) < 0) {
perror("taglia_write");
return 1;

View File

@ -1,3 +1,5 @@
#define _XOPEN_SOURCE 700
#include <signal.h>
#include <unistd.h>
#include <assert.h>
#include <stdio.h>
@ -5,7 +7,6 @@
#include <stdlib.h>
#include <pthread.h>
#include <ctype.h>
#include <signal.h>
#include <sys/select.h>
#include <threadpool.h>
@ -63,8 +64,8 @@ int main(int argc, char *argv[]) {
int maxFiles; CONFGETINT(maxFiles, config, "files", "MaxFiles", NULL, 10);
int maxSize; CONFGETINT(maxSize, config, "files", "MaxSize", NULL, 10);
const char *buff;
char *logFile; CONFGETSTR(logFile, config, "log", "logFile", buff);
char *socketName; CONFGETSTR(socketName, config, "socket", "name", buff);
char *logFile=NULL; CONFGETSTR(logFile, config, "log", "logFile", buff);
char *socketName=NULL; CONFGETSTR(socketName, config, "socket", "name", buff);
int maxBacklog; CONFGETINT(maxBacklog, config, "socket", "backlog", NULL, 10);
ini_free(config);