2006-05-25 09:50:14 +00:00
|
|
|
/*-
|
|
|
|
* Copyright (c) 2006 Robert N. M. Watson
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
|
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
* SUCH DAMAGE.
|
|
|
|
*
|
|
|
|
* $FreeBSD$
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/socket.h>
|
2007-04-19 06:01:08 +00:00
|
|
|
#include <sys/stat.h>
|
2010-02-24 23:00:16 +00:00
|
|
|
#include <sys/wait.h>
|
2006-05-25 09:50:14 +00:00
|
|
|
|
|
|
|
#include <netinet/in.h>
|
|
|
|
|
|
|
|
#include <err.h>
|
2010-02-24 23:00:16 +00:00
|
|
|
#include <errno.h>
|
2006-05-25 09:50:14 +00:00
|
|
|
#include <limits.h>
|
2010-02-24 23:00:16 +00:00
|
|
|
#include <md5.h>
|
2006-05-25 09:50:14 +00:00
|
|
|
#include <signal.h>
|
2007-04-19 07:59:30 +00:00
|
|
|
#include <stdint.h>
|
2006-05-25 09:50:14 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
|
|
|
|
/*
|
2008-09-10 09:32:25 +00:00
|
|
|
* Simple regression test for sendfile. Creates a file sized at four pages
|
2006-05-25 09:50:14 +00:00
|
|
|
* and then proceeds to send it over a series of sockets, exercising a number
|
|
|
|
* of cases and performing limited validation.
|
|
|
|
*/
|
|
|
|
|
2010-02-24 23:00:16 +00:00
|
|
|
#define FAIL(msg) {printf("# %s\n", msg); \
|
|
|
|
return (-1);}
|
|
|
|
|
|
|
|
#define FAIL_ERR(msg) {printf("# %s: %s\n", msg, strerror(errno)); \
|
|
|
|
return (-1);}
|
|
|
|
|
2006-05-25 09:50:14 +00:00
|
|
|
#define TEST_PORT 5678
|
|
|
|
#define TEST_MAGIC 0x4440f7bb
|
2007-04-19 06:01:08 +00:00
|
|
|
#define TEST_PAGES 4
|
2006-05-25 09:50:14 +00:00
|
|
|
#define TEST_SECONDS 30
|
|
|
|
|
|
|
|
struct test_header {
|
2010-02-24 23:00:16 +00:00
|
|
|
uint32_t th_magic;
|
|
|
|
uint32_t th_header_length;
|
|
|
|
uint32_t th_offset;
|
|
|
|
uint32_t th_length;
|
|
|
|
char th_md5[33];
|
|
|
|
};
|
|
|
|
|
|
|
|
struct sendfile_test {
|
|
|
|
uint32_t hdr_length;
|
|
|
|
uint32_t offset;
|
|
|
|
uint32_t length;
|
2006-05-25 09:50:14 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
int file_fd;
|
2010-02-24 23:00:16 +00:00
|
|
|
char path[PATH_MAX];
|
|
|
|
int listen_socket;
|
|
|
|
int accept_socket;
|
|
|
|
|
|
|
|
static int test_th(struct test_header *th, uint32_t *header_length,
|
|
|
|
uint32_t *offset, uint32_t *length);
|
|
|
|
static void signal_alarm(int signum);
|
|
|
|
static void setup_alarm(int seconds);
|
|
|
|
static void cancel_alarm(void);
|
|
|
|
static int receive_test(void);
|
|
|
|
static void run_child(void);
|
|
|
|
static int new_test_socket(int *connect_socket);
|
|
|
|
static void init_th(struct test_header *th, uint32_t header_length,
|
|
|
|
uint32_t offset, uint32_t length);
|
|
|
|
static int send_test(int connect_socket, struct sendfile_test);
|
|
|
|
static void run_parent(void);
|
|
|
|
static void cleanup(void);
|
|
|
|
|
2006-05-25 09:50:14 +00:00
|
|
|
|
|
|
|
static int
|
2010-02-24 23:00:16 +00:00
|
|
|
test_th(struct test_header *th, uint32_t *header_length, uint32_t *offset,
|
|
|
|
uint32_t *length)
|
2006-05-25 09:50:14 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
if (th->th_magic != htonl(TEST_MAGIC))
|
2010-02-24 23:00:16 +00:00
|
|
|
FAIL("magic number not found in header")
|
2006-05-25 09:50:14 +00:00
|
|
|
*header_length = ntohl(th->th_header_length);
|
|
|
|
*offset = ntohl(th->th_offset);
|
|
|
|
*length = ntohl(th->th_length);
|
2010-02-24 23:00:16 +00:00
|
|
|
return (0);
|
2006-05-25 09:50:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
signal_alarm(int signum)
|
|
|
|
{
|
2007-04-19 07:59:30 +00:00
|
|
|
(void)signum;
|
2010-02-24 23:00:16 +00:00
|
|
|
|
|
|
|
printf("# test timeout\n");
|
|
|
|
|
|
|
|
if (accept_socket > 0)
|
|
|
|
close(accept_socket);
|
|
|
|
if (listen_socket > 0)
|
|
|
|
close(listen_socket);
|
|
|
|
|
|
|
|
_exit(-1);
|
2006-05-25 09:50:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
setup_alarm(int seconds)
|
|
|
|
{
|
2010-02-24 23:00:16 +00:00
|
|
|
struct itimerval itv;
|
|
|
|
bzero(&itv, sizeof(itv));
|
|
|
|
(void)seconds;
|
|
|
|
itv.it_value.tv_sec = seconds;
|
2006-05-25 09:50:14 +00:00
|
|
|
|
|
|
|
signal(SIGALRM, signal_alarm);
|
2010-02-24 23:00:16 +00:00
|
|
|
setitimer(ITIMER_REAL, &itv, NULL);
|
2006-05-25 09:50:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
cancel_alarm(void)
|
|
|
|
{
|
2010-02-24 23:00:16 +00:00
|
|
|
struct itimerval itv;
|
|
|
|
bzero(&itv, sizeof(itv));
|
|
|
|
setitimer(ITIMER_REAL, &itv, NULL);
|
2006-05-25 09:50:14 +00:00
|
|
|
}
|
|
|
|
|
2010-02-24 23:00:16 +00:00
|
|
|
static int
|
|
|
|
receive_test(void)
|
2006-05-25 09:50:14 +00:00
|
|
|
{
|
2010-02-24 23:00:16 +00:00
|
|
|
uint32_t header_length, offset, length, counter;
|
2006-05-25 09:50:14 +00:00
|
|
|
struct test_header th;
|
|
|
|
ssize_t len;
|
2010-02-24 23:00:16 +00:00
|
|
|
char buf[10240];
|
|
|
|
MD5_CTX md5ctx;
|
|
|
|
char *rxmd5;
|
2006-05-25 09:50:14 +00:00
|
|
|
|
|
|
|
len = read(accept_socket, &th, sizeof(th));
|
2010-02-24 23:00:16 +00:00
|
|
|
if (len < 0 || (size_t)len < sizeof(th))
|
|
|
|
FAIL_ERR("read")
|
2006-05-25 09:50:14 +00:00
|
|
|
|
2010-02-24 23:00:16 +00:00
|
|
|
if (test_th(&th, &header_length, &offset, &length) != 0)
|
|
|
|
return (-1);
|
|
|
|
|
|
|
|
MD5Init(&md5ctx);
|
2006-05-25 09:50:14 +00:00
|
|
|
|
|
|
|
counter = 0;
|
|
|
|
while (1) {
|
2010-02-24 23:00:16 +00:00
|
|
|
len = read(accept_socket, buf, sizeof(buf));
|
|
|
|
if (len < 0 || len == 0)
|
2006-05-25 09:50:14 +00:00
|
|
|
break;
|
2010-02-24 23:00:16 +00:00
|
|
|
counter += len;
|
|
|
|
MD5Update(&md5ctx, buf, len);
|
2006-05-25 09:50:14 +00:00
|
|
|
}
|
2010-02-24 23:00:16 +00:00
|
|
|
|
|
|
|
rxmd5 = MD5End(&md5ctx, NULL);
|
|
|
|
|
|
|
|
if ((counter != header_length+length) ||
|
|
|
|
memcmp(th.th_md5, rxmd5, 33) != 0)
|
|
|
|
FAIL("receive length mismatch")
|
|
|
|
|
|
|
|
free(rxmd5);
|
|
|
|
return (0);
|
2006-05-25 09:50:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
run_child(void)
|
|
|
|
{
|
2010-02-24 23:00:16 +00:00
|
|
|
struct sockaddr_in sin;
|
|
|
|
int rc = 0;
|
2006-05-25 09:50:14 +00:00
|
|
|
|
2010-02-24 23:00:16 +00:00
|
|
|
listen_socket = socket(PF_INET, SOCK_STREAM, 0);
|
|
|
|
if (listen_socket < 0) {
|
|
|
|
printf("# socket: %s\n", strerror(errno));
|
|
|
|
rc = -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!rc) {
|
|
|
|
bzero(&sin, sizeof(sin));
|
|
|
|
sin.sin_len = sizeof(sin);
|
|
|
|
sin.sin_family = AF_INET;
|
|
|
|
sin.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
|
|
|
|
sin.sin_port = htons(TEST_PORT);
|
|
|
|
|
|
|
|
if (bind(listen_socket, (struct sockaddr *)&sin, sizeof(sin)) < 0) {
|
|
|
|
printf("# bind: %s\n", strerror(errno));
|
|
|
|
rc = -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!rc && listen(listen_socket, -1) < 0) {
|
|
|
|
printf("# listen: %s\n", strerror(errno));
|
|
|
|
rc = -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!rc) {
|
2006-05-25 09:50:14 +00:00
|
|
|
accept_socket = accept(listen_socket, NULL, NULL);
|
|
|
|
setup_alarm(TEST_SECONDS);
|
2010-02-24 23:00:16 +00:00
|
|
|
if (receive_test() != 0)
|
|
|
|
rc = -1;
|
2006-05-25 09:50:14 +00:00
|
|
|
}
|
2010-02-24 23:00:16 +00:00
|
|
|
|
|
|
|
cancel_alarm();
|
|
|
|
if (accept_socket > 0)
|
|
|
|
close(accept_socket);
|
|
|
|
if (listen_socket > 0)
|
|
|
|
close(listen_socket);
|
|
|
|
|
|
|
|
_exit(rc);
|
2006-05-25 09:50:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2010-02-24 23:00:16 +00:00
|
|
|
new_test_socket(int *connect_socket)
|
2006-05-25 09:50:14 +00:00
|
|
|
{
|
|
|
|
struct sockaddr_in sin;
|
2010-02-24 23:00:16 +00:00
|
|
|
int rc = 0;
|
2006-05-25 09:50:14 +00:00
|
|
|
|
2010-02-24 23:00:16 +00:00
|
|
|
*connect_socket = socket(PF_INET, SOCK_STREAM, 0);
|
|
|
|
if (*connect_socket < 0)
|
|
|
|
FAIL_ERR("socket")
|
2006-05-25 09:50:14 +00:00
|
|
|
|
|
|
|
bzero(&sin, sizeof(sin));
|
|
|
|
sin.sin_len = sizeof(sin);
|
|
|
|
sin.sin_family = AF_INET;
|
|
|
|
sin.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
|
|
|
|
sin.sin_port = htons(TEST_PORT);
|
|
|
|
|
2010-02-24 23:00:16 +00:00
|
|
|
if (connect(*connect_socket, (struct sockaddr *)&sin, sizeof(sin)) < 0)
|
|
|
|
FAIL_ERR("connect")
|
2006-05-25 09:50:14 +00:00
|
|
|
|
2010-02-24 23:00:16 +00:00
|
|
|
return (rc);
|
2006-05-25 09:50:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2010-02-24 23:00:16 +00:00
|
|
|
init_th(struct test_header *th, uint32_t header_length, uint32_t offset,
|
|
|
|
uint32_t length)
|
2006-05-25 09:50:14 +00:00
|
|
|
{
|
|
|
|
bzero(th, sizeof(*th));
|
|
|
|
th->th_magic = htonl(TEST_MAGIC);
|
|
|
|
th->th_header_length = htonl(header_length);
|
|
|
|
th->th_offset = htonl(offset);
|
|
|
|
th->th_length = htonl(length);
|
2010-02-24 23:00:16 +00:00
|
|
|
|
|
|
|
MD5FileChunk(path, th->th_md5, offset, length);
|
2006-05-25 09:50:14 +00:00
|
|
|
}
|
|
|
|
|
2010-02-24 23:00:16 +00:00
|
|
|
static int
|
|
|
|
send_test(int connect_socket, struct sendfile_test test)
|
2006-05-25 09:50:14 +00:00
|
|
|
{
|
|
|
|
struct test_header th;
|
|
|
|
struct sf_hdtr hdtr, *hdtrp;
|
|
|
|
struct iovec headers;
|
|
|
|
char *header;
|
|
|
|
ssize_t len;
|
2010-02-24 23:00:16 +00:00
|
|
|
int length;
|
2006-05-25 09:50:14 +00:00
|
|
|
off_t off;
|
|
|
|
|
|
|
|
len = lseek(file_fd, 0, SEEK_SET);
|
|
|
|
if (len != 0)
|
2010-02-24 23:00:16 +00:00
|
|
|
FAIL_ERR("lseek")
|
2006-05-25 09:50:14 +00:00
|
|
|
|
2010-02-24 23:00:16 +00:00
|
|
|
if (test.length == 0) {
|
|
|
|
struct stat st;
|
|
|
|
if (fstat(file_fd, &st) < 0)
|
|
|
|
FAIL_ERR("fstat")
|
|
|
|
length = st.st_size - test.offset;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
length = test.length;
|
|
|
|
}
|
|
|
|
|
|
|
|
init_th(&th, test.hdr_length, test.offset, length);
|
2006-05-25 09:50:14 +00:00
|
|
|
|
|
|
|
len = write(connect_socket, &th, sizeof(th));
|
|
|
|
if (len != sizeof(th))
|
2010-02-24 23:00:16 +00:00
|
|
|
return (-1);
|
2006-05-25 09:50:14 +00:00
|
|
|
|
2010-02-24 23:00:16 +00:00
|
|
|
if (test.hdr_length != 0) {
|
|
|
|
header = malloc(test.hdr_length);
|
2006-05-25 09:50:14 +00:00
|
|
|
if (header == NULL)
|
2010-02-24 23:00:16 +00:00
|
|
|
FAIL_ERR("malloc")
|
|
|
|
|
2006-05-25 09:50:14 +00:00
|
|
|
hdtrp = &hdtr;
|
|
|
|
bzero(&headers, sizeof(headers));
|
|
|
|
headers.iov_base = header;
|
2010-02-24 23:00:16 +00:00
|
|
|
headers.iov_len = test.hdr_length;
|
2006-05-25 09:50:14 +00:00
|
|
|
bzero(&hdtr, sizeof(hdtr));
|
|
|
|
hdtr.headers = &headers;
|
|
|
|
hdtr.hdr_cnt = 1;
|
|
|
|
hdtr.trailers = NULL;
|
|
|
|
hdtr.trl_cnt = 0;
|
|
|
|
} else {
|
|
|
|
hdtrp = NULL;
|
|
|
|
header = NULL;
|
|
|
|
}
|
|
|
|
|
2010-02-24 23:00:16 +00:00
|
|
|
if (sendfile(file_fd, connect_socket, test.offset, test.length,
|
|
|
|
hdtrp, &off, 0) < 0) {
|
|
|
|
if (header != NULL)
|
|
|
|
free(header);
|
|
|
|
FAIL_ERR("sendfile")
|
|
|
|
}
|
2006-05-25 09:50:14 +00:00
|
|
|
|
2007-04-19 06:01:08 +00:00
|
|
|
if (length == 0) {
|
|
|
|
struct stat sb;
|
|
|
|
|
2010-02-24 23:00:16 +00:00
|
|
|
if (fstat(file_fd, &sb) == 0)
|
|
|
|
length = sb.st_size - test.offset;
|
2007-04-19 06:01:08 +00:00
|
|
|
}
|
2006-05-25 09:50:14 +00:00
|
|
|
|
|
|
|
if (header != NULL)
|
|
|
|
free(header);
|
2010-02-24 23:00:16 +00:00
|
|
|
|
|
|
|
if (off != length)
|
|
|
|
FAIL("offset != length")
|
|
|
|
|
|
|
|
return (0);
|
2006-05-25 09:50:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
run_parent(void)
|
|
|
|
{
|
|
|
|
int connect_socket;
|
2010-02-24 23:00:16 +00:00
|
|
|
int status;
|
|
|
|
int test_num;
|
|
|
|
int pid;
|
|
|
|
|
|
|
|
const int pagesize = getpagesize();
|
|
|
|
|
|
|
|
struct sendfile_test tests[10] = {
|
|
|
|
{ .hdr_length = 0, .offset = 0, .length = 1 },
|
|
|
|
{ .hdr_length = 0, .offset = 0, .length = pagesize },
|
|
|
|
{ .hdr_length = 0, .offset = 1, .length = 1 },
|
|
|
|
{ .hdr_length = 0, .offset = 1, .length = pagesize },
|
|
|
|
{ .hdr_length = 0, .offset = pagesize, .length = pagesize },
|
|
|
|
{ .hdr_length = 0, .offset = 0, .length = 2*pagesize },
|
|
|
|
{ .hdr_length = 0, .offset = 0, .length = 0 },
|
|
|
|
{ .hdr_length = 0, .offset = pagesize, .length = 0 },
|
|
|
|
{ .hdr_length = 0, .offset = 2*pagesize, .length = 0 },
|
|
|
|
{ .hdr_length = 0, .offset = TEST_PAGES*pagesize, .length = 0 }
|
|
|
|
};
|
|
|
|
|
|
|
|
printf("1..10\n");
|
|
|
|
|
|
|
|
for (test_num = 1; test_num <= 10; test_num++) {
|
|
|
|
|
|
|
|
pid = fork();
|
|
|
|
if (pid == -1) {
|
|
|
|
printf("not ok %d\n", test_num);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (pid == 0)
|
|
|
|
run_child();
|
|
|
|
|
|
|
|
usleep(250000);
|
|
|
|
|
|
|
|
if (new_test_socket(&connect_socket) != 0) {
|
|
|
|
printf("not ok %d\n", test_num);
|
|
|
|
kill(pid, SIGALRM);
|
|
|
|
close(connect_socket);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (send_test(connect_socket, tests[test_num-1]) != 0) {
|
|
|
|
printf("not ok %d\n", test_num);
|
|
|
|
kill(pid, SIGALRM);
|
|
|
|
close(connect_socket);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
close(connect_socket);
|
|
|
|
if (waitpid(pid, &status, 0) == pid) {
|
|
|
|
if (WIFEXITED(status) && WEXITSTATUS(status) == 0)
|
|
|
|
printf("%s %d\n", "ok", test_num);
|
|
|
|
else
|
|
|
|
printf("%s %d\n", "not ok", test_num);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
printf("not ok %d\n", test_num);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2006-05-25 09:50:14 +00:00
|
|
|
|
2010-02-24 23:00:16 +00:00
|
|
|
static void
|
|
|
|
cleanup(void)
|
|
|
|
{
|
|
|
|
if (*path != '\0')
|
|
|
|
unlink(path);
|
2006-05-25 09:50:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2007-04-19 07:59:30 +00:00
|
|
|
main(void)
|
2006-05-25 09:50:14 +00:00
|
|
|
{
|
2010-02-24 23:00:16 +00:00
|
|
|
char *page_buffer;
|
2006-05-25 09:50:14 +00:00
|
|
|
int pagesize;
|
|
|
|
ssize_t len;
|
|
|
|
|
2010-02-24 23:00:16 +00:00
|
|
|
*path = '\0';
|
|
|
|
|
2006-05-25 09:50:14 +00:00
|
|
|
pagesize = getpagesize();
|
|
|
|
page_buffer = malloc(TEST_PAGES * pagesize);
|
|
|
|
if (page_buffer == NULL)
|
2010-02-24 23:00:16 +00:00
|
|
|
FAIL_ERR("malloc")
|
2006-05-25 09:50:14 +00:00
|
|
|
bzero(page_buffer, TEST_PAGES * pagesize);
|
|
|
|
|
|
|
|
snprintf(path, PATH_MAX, "/tmp/sendfile.XXXXXXXXXXXX");
|
|
|
|
file_fd = mkstemp(path);
|
2010-02-24 23:00:16 +00:00
|
|
|
atexit(cleanup);
|
2006-05-25 09:50:14 +00:00
|
|
|
|
|
|
|
len = write(file_fd, page_buffer, TEST_PAGES * pagesize);
|
|
|
|
if (len < 0)
|
2010-02-24 23:00:16 +00:00
|
|
|
FAIL_ERR("write")
|
2006-05-25 09:50:14 +00:00
|
|
|
|
|
|
|
len = lseek(file_fd, 0, SEEK_SET);
|
|
|
|
if (len < 0)
|
2010-02-24 23:00:16 +00:00
|
|
|
FAIL_ERR("lseek")
|
2006-05-25 09:50:14 +00:00
|
|
|
if (len != 0)
|
2010-02-24 23:00:16 +00:00
|
|
|
FAIL("len != 0")
|
2006-05-25 09:50:14 +00:00
|
|
|
|
2010-02-24 23:00:16 +00:00
|
|
|
run_parent();
|
2006-05-25 09:50:14 +00:00
|
|
|
return (0);
|
|
|
|
}
|