mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-03 09:48:29 +00:00
Polish recent changes and make improvements
- Simulate SIGPIPE on Windows NT - Fix commandv() regression on Windows NT - Fix sigprocmask() strace bug on OpenBSD - Add many more system calls to --strace logging - Make errno state more pristine in redbean strace
This commit is contained in:
parent
10a766ebd0
commit
39688a73e4
69 changed files with 460 additions and 1976 deletions
|
@ -30,26 +30,25 @@
|
|||
* @asyncsignalsafe
|
||||
*/
|
||||
int64_t __zipos_lseek(struct ZiposHandle *h, int64_t offset, unsigned whence) {
|
||||
int64_t i;
|
||||
int64_t rc;
|
||||
switch (whence) {
|
||||
case SEEK_SET:
|
||||
i = offset;
|
||||
rc = offset;
|
||||
break;
|
||||
case SEEK_CUR:
|
||||
i = h->pos + offset;
|
||||
rc = h->pos + offset;
|
||||
break;
|
||||
case SEEK_END:
|
||||
i = h->size - offset;
|
||||
rc = h->size - offset;
|
||||
break;
|
||||
default:
|
||||
return einval();
|
||||
rc = -1;
|
||||
break;
|
||||
}
|
||||
if (i < 0) {
|
||||
return einval();
|
||||
if (rc >= 0) {
|
||||
h->pos = rc;
|
||||
} else {
|
||||
rc = einval();
|
||||
}
|
||||
h->pos = i;
|
||||
ZTRACE("__zipos_lseek(%.*s, %d)",
|
||||
ZIP_CFILE_NAMESIZE(__zipos_get()->map + h->cfile),
|
||||
ZIP_CFILE_NAME(__zipos_get()->map + h->cfile), i);
|
||||
return i;
|
||||
return rc;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue