compiling on linux
This commit is contained in:
@ -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) {
|
||||
|
||||
@ -4,6 +4,8 @@
|
||||
|
||||
#include <time.h>
|
||||
|
||||
struct timespec;
|
||||
|
||||
#define O_CREATE 1
|
||||
#define O_LOCK 2
|
||||
|
||||
|
||||
Reference in New Issue
Block a user