summaryrefslogtreecommitdiff
path: root/libpager
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2000-01-24 07:08:50 +0000
committerRoland McGrath <roland@gnu.org>2000-01-24 07:08:50 +0000
commitb14110af8c96c5b021c1e27209608b032db7586e (patch)
tree702cb2c08223bedb497fbddaf8631a4ed17abfa9 /libpager
parent9d317844f9c789904efcd729f9881a66c44a0a38 (diff)
2000-01-24 Roland McGrath <roland@baalperazim.frob.com>
* pager-memcpy.c (pager_memcpy): Short-circuit return for zero size.
Diffstat (limited to 'libpager')
-rw-r--r--libpager/pager-memcpy.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/libpager/pager-memcpy.c b/libpager/pager-memcpy.c
index f255c68d..ed63c247 100644
--- a/libpager/pager-memcpy.c
+++ b/libpager/pager-memcpy.c
@@ -1,5 +1,5 @@
/* Fault-safe copy into or out of pager-backed memory.
- Copyright (C) 1996, 1997, 1999 Free Software Foundation, Inc.
+ Copyright (C) 1996,97,99,2000 Free Software Foundation, Inc.
Written by Roland McGrath.
This program is free software; you can redistribute it and/or
@@ -88,6 +88,11 @@ pager_memcpy (struct pager *pager, memory_object_t memobj,
longjmp (buf, 1);
}
+ if (to_copy == 0)
+ /* Short-circuit return if nothing to do.
+ ERR would not be initialized by the copy loop in this case. */
+ return 0;
+
if (setjmp (buf) == 0)
hurd_catch_signal (sigmask (SIGSEGV) | sigmask (SIGBUS),
window, window + windowsize,