Skip to content

Commit 3c4bc74

Browse files
pinotreesaghul
authored andcommitted
Use ftello() & fseeko() on any OS based on GNU libc
Strictly speaking, they are available in POSIX.1-2008 [1][2], so they could be used on more platforms/OSes. To be cautious, enable them when using GNU libc, since they have been available with that libc for a very long time. Cherry-pick of bellard/quickjs@8624b5c. [1] https://pubs.opengroup.org/onlinepubs/9699919799/functions/ftell.html [2] https://pubs.opengroup.org/onlinepubs/9699919799/functions/fseek.html
1 parent cfb87ff commit 3c4bc74

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

quickjs-libc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1321,7 +1321,7 @@ static JSValue js_std_file_tell(JSContext *ctx, JSValueConst this_val,
13211321
int64_t pos;
13221322
if (!f)
13231323
return JS_EXCEPTION;
1324-
#if defined(__linux__)
1324+
#if defined(__linux__) || defined(__GLIBC__)
13251325
pos = ftello(f);
13261326
#else
13271327
pos = ftell(f);
@@ -1344,7 +1344,7 @@ static JSValue js_std_file_seek(JSContext *ctx, JSValueConst this_val,
13441344
return JS_EXCEPTION;
13451345
if (JS_ToInt32(ctx, &whence, argv[1]))
13461346
return JS_EXCEPTION;
1347-
#if defined(__linux__)
1347+
#if defined(__linux__) || defined(__GLIBC__)
13481348
ret = fseeko(f, pos, whence);
13491349
#else
13501350
ret = fseek(f, pos, whence);

0 commit comments

Comments
 (0)