}
s->physical_offset = s->logical_offset = offset;
+ s->active = 0;
return (lseek (s->fd, offset, SEEK_SET) < 0) ? FAILURE : SUCCESS;
}
/* non-seekable files, like terminals and fifo's fail the lseek.
Using ftruncate on a seekable special file (like /dev/null)
- is undefined, so we treat it as if the ftruncate failed.
+ is undefined, so we treat it as if the ftruncate succeeded.
*/
#ifdef HAVE_FTRUNCATE
if (s->special_file || ftruncate (s->fd, s->logical_offset))
#endif
{
s->physical_offset = s->file_length = 0;
- return FAILURE;
+ return SUCCESS;
}
s->physical_offset = s->file_length = s->logical_offset;
static try
mem_close (unix_stream * s)
{
- free_mem (s);
+ if (s != NULL)
+ free_mem (s);
return SUCCESS;
}