summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
Diffstat (limited to 'source3')
-rw-r--r--source3/lib/util.c5
-rw-r--r--source3/lib/util_str.c4
2 files changed, 7 insertions, 2 deletions
diff --git a/source3/lib/util.c b/source3/lib/util.c
index 455f87aaab..d910dff547 100644
--- a/source3/lib/util.c
+++ b/source3/lib/util.c
@@ -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);
}
diff --git a/source3/lib/util_str.c b/source3/lib/util_str.c
index 6b6581b4a7..394c8e27cf 100644
--- a/source3/lib/util_str.c
+++ b/source3/lib/util_str.c
@@ -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;
}