r5066: A couple of small fixes from James Peach @ SGI.
authorJeremy Allison <jra@samba.org>
Fri, 28 Jan 2005 21:55:45 +0000 (21:55 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 15:55:13 +0000 (10:55 -0500)
Jeremy.
(This used to be commit 9d131e94195df79e07c8fad20e12ba1b67441a81)

source3/lib/util.c
source3/lib/util_str.c

index 455f87aaab8f25dde66ea0ed6a35f6752a14adb1..d910dff5477194ff2031cb85f3a6e3077da9c069 100644 (file)
@@ -1534,6 +1534,11 @@ void smb_panic2(const char *why, BOOL decrement_pid_count )
                ZERO_ARRAY(names);
                ZERO_ARRAY(namebuf);
 
+               /* We need to be root so we can open our /proc entry to walk
+                * our stack. It also helps when we want to dump core.
+                */
+               become_root();
+
                for (i = 0; i < BACKTRACE_STACK_SIZE; i++) {
                        names[i] = namebuf + (i * NAMESIZE);
                }
index 6b6581b4a7b08001bc0fdd81688960ede9dc44fc..394c8e27cff2a31696df30abacf08b90b545d3ac 100644 (file)
@@ -1558,8 +1558,8 @@ int fstr_sprintf(fstring s, const char *fmt, ...)
 
  size_t strnlen(const char *s, size_t n)
 {
-       int i;
-       for (i=0; s[i] && i<n; i++)
+       size_t i;
+       for (i=0; i<n && s[i] != '\0'; i++)
                /* noop */ ;
        return i;
 }