mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2025-07-19 01:05:15 +03:00
This replaces the bootstrapping (and outdated) LDC 1.8.0 package with a build from source.
37 lines
1.6 KiB
Diff
37 lines
1.6 KiB
Diff
--- a/runtime/phobos/std/stdio.d 2019-10-25 12:00:00.000000000 +0900
|
|
+++ b/runtime/phobos/std/stdio.d 2019-10-25 12:42:42.000000000 +0900
|
|
@@ -1098,6 +1098,14 @@ Throws: `Exception` if the file is not o
|
|
import std.conv : to, text;
|
|
import std.exception : enforce, errnoEnforce;
|
|
|
|
+ // Some libc sanitize the whence input (e.g. glibc), but some don't,
|
|
+ // e.g. Microsoft runtime crashes on an invalid origin,
|
|
+ // and Musl additionally accept SEEK_DATA & SEEK_HOLE (Linux extension).
|
|
+ // To provide a consistent behavior cross platform, we use the glibc check
|
|
+ // See also https://issues.dlang.org/show_bug.cgi?id=19797
|
|
+ enforce(origin == SEEK_SET || origin == SEEK_CUR || origin == SEEK_END,
|
|
+ "Invalid `origin` argument passed to `seek`, must be one of: SEEK_SET, SEEK_CUR, SEEK_END");
|
|
+
|
|
enforce(isOpen, "Attempting to seek() in an unopened file");
|
|
version (Windows)
|
|
{
|
|
@@ -1105,9 +1113,6 @@ Throws: `Exception` if the file is not o
|
|
{
|
|
alias fseekFun = _fseeki64;
|
|
alias off_t = long;
|
|
- // Issue 19797
|
|
- enforce(origin >= SEEK_SET && origin <= SEEK_END,
|
|
- "Could not seek in file `"~_name~"' (Invalid argument)");
|
|
}
|
|
else
|
|
{
|
|
@@ -1151,7 +1156,8 @@ Throws: `Exception` if the file is not o
|
|
// f.rawWrite("abcdefghijklmnopqrstuvwxyz");
|
|
// f.seek(-3, SEEK_END);
|
|
// assert(f.readln() == "xyz");
|
|
- assertThrown(f.seek(0, 3));
|
|
+
|
|
+ assertThrown(f.seek(0, ushort.max));
|
|
}
|
|
|
|
/**
|