Page MenuHomeFreeBSD

D26612.diff
No OneTemporary

D26612.diff

Index: head/sys/kern/subr_syscall.c
===================================================================
--- head/sys/kern/subr_syscall.c
+++ head/sys/kern/subr_syscall.c
@@ -138,7 +138,8 @@
(void)sigfastblock_fetch(td);
/* Let system calls set td_errno directly. */
- td->td_pflags &= ~TDP_NERRNO;
+ KASSERT((td->td_pflags & TDP_NERRNO) == 0,
+ ("%s: TDP_NERRNO set", __func__));
if (__predict_false(SYSTRACE_ENABLED() ||
AUDIT_SYSCALL_ENTER(sa->code, td))) {
@@ -149,7 +150,9 @@
#endif
error = (sa->callp->sy_call)(td, sa->args);
/* Save the latest error return value. */
- if (__predict_false((td->td_pflags & TDP_NERRNO) == 0))
+ if (__predict_false((td->td_pflags & TDP_NERRNO) != 0))
+ td->td_pflags &= ~TDP_NERRNO;
+ else
td->td_errno = error;
AUDIT_SYSCALL_EXIT(error, td);
#ifdef KDTRACE_HOOKS
@@ -161,7 +164,9 @@
} else {
error = (sa->callp->sy_call)(td, sa->args);
/* Save the latest error return value. */
- if (__predict_false((td->td_pflags & TDP_NERRNO) == 0))
+ if (__predict_false((td->td_pflags & TDP_NERRNO) != 0))
+ td->td_pflags &= ~TDP_NERRNO;
+ else
td->td_errno = error;
}
syscall_thread_exit(td, sa->callp);

File Metadata

Mime Type
text/plain
Expires
Mon, Mar 23, 3:35 PM (14 h, 4 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
30192123
Default Alt Text
D26612.diff (1 KB)

Event Timeline