compiling on linux

This commit is contained in:
elvis
2022-04-24 13:01:13 +02:00
parent 9eaf9cdd49
commit d7f555bf21
4 changed files with 13 additions and 6 deletions

View File

@ -1,3 +1,5 @@
#define _POSIX_C_SOURCE 200809L
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
@ -6,6 +8,7 @@
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <time.h>
#include <sys/un.h>
#include <unistd.h>
#include <math.h>
@ -1431,7 +1434,7 @@ int storeFilesInDirectory(const char *dirname, int n, recivedFile_t *rf) {
return -1;
}
strcpy(basepath, dirname);
strlcat(basepath, "/", basepathlen);
strncat(basepath, "/", basepathlen);
// for each file, create and write
for(int i=0;i<n;++i) {
@ -1442,7 +1445,7 @@ int storeFilesInDirectory(const char *dirname, int n, recivedFile_t *rf) {
return -1;
}
strcpy(filename, basepath);
strlcat(filename, rf[i].path, basepathlen + rf[i].pathlen);
strncat(filename, rf[i].path, basepathlen + rf[i].pathlen);
int fdo;
if((fdo = open(filename, O_WRONLY | O_CREAT, 0666)) == -1) { // open
@ -1527,7 +1530,7 @@ int addOpenFile(const char *pathname) {
return -1;
}
strlcpy(new->filename, pathname, len);
strncpy(new->filename, pathname, len);
new->next = NULL;
if(openedFiles->f == NULL) {