Skip to content

Commit

Permalink
tools/env: Support for large device
Browse files Browse the repository at this point in the history
  • Loading branch information
hmz007 committed Aug 8, 2015
1 parent 306b7ab commit 70cdee1
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions tools/env/fw_env.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
* MA 02111-1307 USA
*/

#define _LARGEFILE64_SOURCE /* See feature_test_macros(7) */

#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
Expand Down Expand Up @@ -395,7 +397,7 @@ int fw_setenv (int argc, char *argv[])
static int flash_mmc (int mode)
{
int fd, rc, len;
off_t pos;
long long pos;

if ((fd = open (DEVNAME (curdev), mode)) < 0) {
fprintf (stderr,
Expand All @@ -409,10 +411,10 @@ static int flash_mmc (int mode)
len += sizeof (environment.flags);
}

pos = lseek (fd, - DEVOFFSET (curdev), SEEK_END);
pos = lseek64 (fd, - (long long) DEVOFFSET (curdev), SEEK_END);
if (pos > 0 && pos < 2000000000) {
/* forward 1024 sectors for SD card */
pos = lseek (fd, 1024*512, SEEK_CUR);
pos = lseek64 (fd, 1024*512, SEEK_CUR);
}
if (pos == -1) {
fprintf (stderr,
Expand Down

0 comments on commit 70cdee1

Please sign in to comment.