Files
RedBear-OS/tests/unistd/ftruncate.c
T
Red Bear OS 1b3e94a20d Red Bear OS relibc baseline
From release 0.1.0 pre-patched archive.
This includes all Red Bear modifications previously maintained
as patches in local/patches/relibc/.
2026-06-27 09:19:26 +03:00

25 lines
555 B
C

#include <unistd.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include "test_helpers.h"
int main(void) {
int fd = creat("ftruncate.out", 0777);
ERROR_IF(creat, fd, == -1);
UNEXP_IF(creat, fd, < 0);
int status = ftruncate(fd, 100);
ERROR_IF(ftruncate, status, == -1);
UNEXP_IF(ftruncate, status, != 0);
int c = close(fd);
ERROR_IF(close, c, == -1);
UNEXP_IF(close, c, != 0);
status = truncate("ftruncate.out", 100);
ERROR_IF(truncate, status, == -1);
UNEXP_IF(truncate, status, != 0);
}