[klibc] bunch of small fixes

maximilian attems max at stro.at
Sun Jul 13 03:43:09 PDT 2008


hello hpa,

current chroot util stands out as broken and
found an old nfsmount commit on a stray testbox
in our institue.

thanks for taking a look!
maks

git pull git://git.debian.org/~maks/klibc.git maks

for the changes:
maximilian attems (4):
      [klibc] malloc fix compile with DEBUG_MALLOC
      [klibc] README: add klibc email
      [klibc] nfsmount: improve error message
      [klibc] chroot: Fix expected behaviour

git diff --stat master..
 README                     |    2 ++
 usr/kinit/nfsmount/mount.c |    4 ++--
 usr/klibc/malloc.c         |    1 +
 usr/utils/chroot.c         |    9 +++++++--
 4 files changed, 12 insertions(+), 4 deletions(-)

commit 9500dd5c8890b190c4e1267848e1db20fcc54fee
Author: maximilian attems <max at stro.at>
Date:   Sun Jul 13 12:22:16 2008 +0200

    [klibc] chroot: Fix expected behaviour
    
    /usr/lib/klibc/bin/chroot / sh
    execve: No such file or directory
    /usr/lib/klibc/bin/chroot / /bin/pwd
    /home/max
    
    ./src/klibc/usr/utils/static/chroot / pwd
    /
    
    Cc: Colin Watson <cjwatson at ubuntu.com>
    Signed-off-by: maximilian attems <max at stro.at>

diff --git a/usr/utils/chroot.c b/usr/utils/chroot.c
index e3e6791..bc1b94f 100644
--- a/usr/utils/chroot.c
+++ b/usr/utils/chroot.c
@@ -16,8 +16,13 @@ int main(int argc, char *argv[], char *envp[])
 		return 1;
 	}
 
-	if (execve(argv[2], argv + 2, envp) == -1) {
-		perror("execve");
+	if (chdir("/") == -1) {
+		perror("chdir");
+		return 1;
+	}
+
+	if (execvp(argv[2], argv + 2) == -1) {
+		perror("execvp");
 		return 1;
 	}
 

commit 6b76f2cbacd3ad94c8ce9dfaf4a6fa4484636f84
Author: maximilian attems <max at stro.at>
Date:   Mon Sep 4 18:37:11 2006 +0200

    [klibc] nfsmount: improve error message
    
    use in failure path strerror(), beautifies error message:
    mount call failed: 13
    ->
    mount call failed - server replied: Permission denied.
    
    Signed-off-by: maximilian attems <max at stro.at>

diff --git a/usr/kinit/nfsmount/mount.c b/usr/kinit/nfsmount/mount.c
index 066f6cd..a55af91 100644
--- a/usr/kinit/nfsmount/mount.c
+++ b/usr/kinit/nfsmount/mount.c
@@ -187,8 +187,8 @@ static int mount_call(uint32_t proc, uint32_t version,
 	}
 
 	if (mnt_reply.status != 0) {
-		fprintf(stderr, "mount call failed: %d\n",
-			ntohl(mnt_reply.status));
+		fprintf(stderr, "mount call failed - server replied: %s.\n",
+			strerror(ntohl(mnt_reply.status)));
 		goto bail;
 	}
 

commit 760e98ddc031f335daad386d1e731eb5de1843ce
Author: maximilian attems <max at stro.at>
Date:   Tue Jun 17 15:23:23 2008 +0200

    [klibc] README: add klibc email
    
    Tarball should contain email of the klibc mailinglist.
    
    Signed-off-by: maximilian attems <max at stro.at>

diff --git a/README b/README
index 30e4b59..b2439cd 100644
--- a/README
+++ b/README
@@ -9,6 +9,8 @@ klibc is archived at:
 
 There is a mailing list for klibc and early-userspace issues at:
 
+	klibc at zytor.com
+
 	http://www.zytor.com/mailman/listinfo/klibc/
 
 klibc is maintained in the git version control system.  The git

commit 003bf47681731bf8a3f2941a666ecffefeaeb29e
Author: maximilian attems <max at stro.at>
Date:   Sun Jun 22 16:02:41 2008 +0200

    [klibc] malloc fix compile with DEBUG_MALLOC
    
    usr/klibc/malloc.o: In function `free':
    /home/max/src/klibc/usr/klibc/malloc.c:215: undefined reference to `assert'
    
    Signed-off-by: maximilian attems <max at stro.at>

diff --git a/usr/klibc/malloc.c b/usr/klibc/malloc.c
index fbbbbbc..413b733 100644
--- a/usr/klibc/malloc.c
+++ b/usr/klibc/malloc.c
@@ -7,6 +7,7 @@
 #include <stdlib.h>
 #include <unistd.h>
 #include <sys/mman.h>
+#include <assert.h>
 #include "malloc.h"
 
 /* Both the arena list and the free memory list are double linked



More information about the klibc mailing list