diff options
author | glebius <glebius@FreeBSD.org> | 2015-10-26 11:35:40 +0000 |
---|---|---|
committer | glebius <glebius@FreeBSD.org> | 2015-10-26 11:35:40 +0000 |
commit | c62812877398840dae0ba74b03e9e6a43cc56fc5 (patch) | |
tree | 304551aa93f09787d4f56a966c6409faf1b1bcb0 /contrib/ntp/sntp/tests/fileHandlingTest.c | |
parent | 9e809ce638c9be9ffb800ced1b91c0e8997f4c9e (diff) | |
download | FreeBSD-src-c62812877398840dae0ba74b03e9e6a43cc56fc5.zip FreeBSD-src-c62812877398840dae0ba74b03e9e6a43cc56fc5.tar.gz |
Upgrade NTP to 4.2.8p4.
Security: FreeBSD-SA-15:25.ntp
Security: CVE-2015-7871
Security: CVE-2015-7855
Security: CVE-2015-7854
Security: CVE-2015-7853
Security: CVE-2015-7852
Security: CVE-2015-7851
Security: CVE-2015-7850
Security: CVE-2015-7849
Security: CVE-2015-7848
Security: CVE-2015-7701
Security: CVE-2015-7703
Security: CVE-2015-7704, CVE-2015-7705
Security: CVE-2015-7691, CVE-2015-7692, CVE-2015-7702
Diffstat (limited to 'contrib/ntp/sntp/tests/fileHandlingTest.c')
-rw-r--r-- | contrib/ntp/sntp/tests/fileHandlingTest.c | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/contrib/ntp/sntp/tests/fileHandlingTest.c b/contrib/ntp/sntp/tests/fileHandlingTest.c new file mode 100644 index 0000000..ce3f0de --- /dev/null +++ b/contrib/ntp/sntp/tests/fileHandlingTest.c @@ -0,0 +1,74 @@ + +#include "config.h" +#include "stdlib.h" +#include "sntptest.h" + +#include "fileHandlingTest.h" //required because of the h.in thingy + +#include <string.h> +#include <unistd.h> + +/* +enum DirectoryType { + INPUT_DIR = 0, + OUTPUT_DIR = 1 +}; +*/ +//extern const char srcdir[]; + +const char * +CreatePath(const char* filename, enum DirectoryType argument) { + const char srcdir[] = SRCDIR_DEF;//"@abs_srcdir@/data/"; + char * path = emalloc (sizeof (char) * (strlen(srcdir) + 256)); + + //char cwd[1024]; + + strcpy(path, srcdir); + strcat(path, filename); + + return path; +} + + +int +GetFileSize(FILE *file) { + fseek(file, 0L, SEEK_END); + int length = ftell(file); + fseek(file, 0L, SEEK_SET); + + return length; +} + + +bool +CompareFileContent(FILE* expected, FILE* actual) { + int currentLine = 1; + + char actualLine[1024]; + char expectedLine[1024]; + size_t lenAct = sizeof actualLine; + size_t lenExp = sizeof expectedLine; + + while ( ( (fgets(actualLine, lenAct, actual)) != NULL) + && ( (fgets(expectedLine, lenExp, expected)) != NULL ) + ) { + + + if( strcmp(actualLine,expectedLine) !=0 ){ + printf("Comparision failed on line %d",currentLine); + return FALSE; + } + + currentLine++; + } + + return TRUE; +} + + +void +ClearFile(const char * filename) { + if (!truncate(filename, 0)) + exit(1); +} + |