From b14110af8c96c5b021c1e27209608b032db7586e Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Mon, 24 Jan 2000 07:08:50 +0000 Subject: 2000-01-24 Roland McGrath * pager-memcpy.c (pager_memcpy): Short-circuit return for zero size. --- libpager/pager-memcpy.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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, -- cgit v1.2.3