Merge pull request #14 from charles-dyfis-net/issues/11

Move from loff_t to off64_t for musl libc support (#11)
This commit is contained in:
Martijn van Brummelen
2016-07-27 08:03:26 +02:00
committed by GitHub
3 changed files with 15 additions and 15 deletions

View File

@@ -82,7 +82,7 @@ typedef struct nwipe_context_t_
int device_minor; /* The minor device number. */
int device_part; /* The device partition or slice number. */
char* device_name; /* The device file name. */
loff_t device_size; /* The device size in bytes. */
off64_t device_size; /* The device size in bytes. */
struct stat device_stat; /* The device file state from fstat(). */
nwipe_device_t device_type; /* Indicates an IDE, SCSI, or Compaq SMART device. */
int device_target; /* The device target. */

View File

@@ -354,7 +354,7 @@ int main( int argc, char** argv )
}
if( c2[i]->device_size == (loff_t)-1 )
if( c2[i]->device_size == (off64_t)-1 )
{
/* We cannot determine the size of this device. */
nwipe_perror( errno, __FUNCTION__, "lseek" );
@@ -367,7 +367,7 @@ int main( int argc, char** argv )
/* Reset the file pointer. */
r = lseek( c2[i]->device_fd, 0, SEEK_SET );
if( r == (loff_t)-1 )
if( r == (off64_t)-1 )
{
nwipe_perror( errno, __FUNCTION__, "lseek" );
nwipe_log( NWIPE_LOG_ERROR, "Unable to reset the '%s' file offset.", c2[i]->device_name );

View File

@@ -46,7 +46,7 @@ int nwipe_random_verify( nwipe_context_t* c )
size_t blocksize;
/* The result buffer for calls to lseek. */
loff_t offset;
off64_t offset;
/* The input buffer. */
char* b;
@@ -98,7 +98,7 @@ int nwipe_random_verify( nwipe_context_t* c )
/* Reset the pass byte counter. */
c->pass_done = 0;
if( offset == (loff_t)-1 )
if( offset == (off64_t)-1 )
{
nwipe_perror( errno, __FUNCTION__, "lseek" );
nwipe_log( NWIPE_LOG_FATAL, "Unable to reset the '%s' file offset.", c->device_name );
@@ -177,7 +177,7 @@ int nwipe_random_verify( nwipe_context_t* c )
/* Bump the file pointer to the next block. */
offset = lseek( c->device_fd, s, SEEK_CUR );
if( offset == (loff_t)-1 )
if( offset == (off64_t)-1 )
{
nwipe_perror( errno, __FUNCTION__, "lseek" );
nwipe_log( NWIPE_LOG_ERROR, "Unable to bump the '%s' file offset after a partial read.", c->device_name );
@@ -225,7 +225,7 @@ int nwipe_random_pass( NWIPE_METHOD_SIGNATURE )
size_t blocksize;
/* The result buffer for calls to lseek. */
loff_t offset;
off64_t offset;
/* The output buffer. */
char* b;
@@ -267,7 +267,7 @@ int nwipe_random_pass( NWIPE_METHOD_SIGNATURE )
/* Reset the pass byte counter. */
c->pass_done = 0;
if( offset == (loff_t)-1 )
if( offset == (off64_t)-1 )
{
nwipe_perror( errno, __FUNCTION__, "lseek" );
nwipe_log( NWIPE_LOG_FATAL, "Unable to reset the '%s' file offset.", c->device_name );
@@ -328,7 +328,7 @@ int nwipe_random_pass( NWIPE_METHOD_SIGNATURE )
/* Bump the file pointer to the next block. */
offset = lseek( c->device_fd, s, SEEK_CUR );
if( offset == (loff_t)-1 )
if( offset == (off64_t)-1 )
{
nwipe_perror( errno, __FUNCTION__, "lseek" );
nwipe_log( NWIPE_LOG_ERROR, "Unable to bump the '%s' file offset after a partial write.", c->device_name );
@@ -388,7 +388,7 @@ int nwipe_static_verify( NWIPE_METHOD_SIGNATURE, nwipe_pattern_t* pattern )
size_t blocksize;
/* The result buffer for calls to lseek. */
loff_t offset;
off64_t offset;
/* The input buffer. */
char* b;
@@ -470,7 +470,7 @@ int nwipe_static_verify( NWIPE_METHOD_SIGNATURE, nwipe_pattern_t* pattern )
/* Reset the pass byte counter. */
c->pass_done = 0;
if( offset == (loff_t)-1 )
if( offset == (off64_t)-1 )
{
nwipe_perror( errno, __FUNCTION__, "lseek" );
nwipe_log( NWIPE_LOG_FATAL, "Unable to reset the '%s' file offset.", c->device_name );
@@ -534,7 +534,7 @@ int nwipe_static_verify( NWIPE_METHOD_SIGNATURE, nwipe_pattern_t* pattern )
/* Bump the file pointer to the next block. */
offset = lseek( c->device_fd, s, SEEK_CUR );
if( offset == (loff_t)-1 )
if( offset == (off64_t)-1 )
{
nwipe_perror( errno, __FUNCTION__, "lseek" );
nwipe_log( NWIPE_LOG_ERROR, "Unable to bump the '%s' file offset after a partial read.", c->device_name );
@@ -587,7 +587,7 @@ int nwipe_static_pass( NWIPE_METHOD_SIGNATURE, nwipe_pattern_t* pattern )
size_t blocksize;
/* The result buffer for calls to lseek. */
loff_t offset;
off64_t offset;
/* The output buffer. */
char* b;
@@ -638,7 +638,7 @@ int nwipe_static_pass( NWIPE_METHOD_SIGNATURE, nwipe_pattern_t* pattern )
/* Reset the pass byte counter. */
c->pass_done = 0;
if( offset == (loff_t)-1 )
if( offset == (off64_t)-1 )
{
nwipe_perror( errno, __FUNCTION__, "lseek" );
nwipe_log( NWIPE_LOG_FATAL, "Unable to reset the '%s' file offset.", c->device_name );
@@ -697,7 +697,7 @@ int nwipe_static_pass( NWIPE_METHOD_SIGNATURE, nwipe_pattern_t* pattern )
/* Bump the file pointer to the next block. */
offset = lseek( c->device_fd, s, SEEK_CUR );
if( offset == (loff_t)-1 )
if( offset == (off64_t)-1 )
{
nwipe_perror( errno, __FUNCTION__, "lseek" );
nwipe_log( NWIPE_LOG_ERROR, "Unable to bump the '%s' file offset after a partial write.", c->device_name );