* Author Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
*
* %Begin-Header%
- * This file may be redistributed under the terms of the GNU Public
- * License.
+ * This file may be redistributed under the terms of the GNU Library
+ * General Public License, version 2.
* %End-Header%
*/
#define _LARGEFILE_SOURCE
#define _LARGEFILE64_SOURCE
+#include "config.h"
#include <stdio.h>
#include <string.h>
#if HAVE_UNISTD_H
block_size = channel->block_size;
io_channel_set_blksize(channel, SUPERBLOCK_OFFSET);
- retval = io_channel_read_blk(channel, 1, -SUPERBLOCK_SIZE, &super);
+ retval = io_channel_read_blk64(channel, 1, -SUPERBLOCK_SIZE, &super);
if (retval)
goto err_out;
return EXT2_ET_BAD_DEVICE_NAME;
retval = ext2fs_get_mem(sizeof(struct struct_io_channel), &io);
if (retval)
- return retval;
+ goto cleanup;
memset(io, 0, sizeof(struct struct_io_channel));
io->magic = EXT2_ET_MAGIC_IO_CHANNEL;
retval = ext2fs_get_mem(sizeof(struct undo_private_data), &data);
* setup err handler for read so that we know
* when the backing manager fails do short read
*/
- undo_err_handler_init(data->real);
+ if (data->real)
+ undo_err_handler_init(data->real);
*channel = io;
return 0;
cleanup:
- if (data->real)
+ if (data && data->real)
io_channel_close(data->real);
if (data)
ext2fs_free_mem(&data);