afs.c: Add log message, cast sizeof().
authorAndre Noll <maan@systemlinux.org>
Wed, 12 Sep 2007 17:46:03 +0000 (19:46 +0200)
committerAndre Noll <maan@systemlinux.org>
Wed, 12 Sep 2007 17:46:03 +0000 (19:46 +0200)
In case the local socket could not be created, we really should
tell the user that fact.

The other change in this patch is casting sizeof() to unsigned
long which shuts gcc up on both i386 and x86_64.

afs.c

diff --git a/afs.c b/afs.c
index d89406f..143103d 100644 (file)
--- a/afs.c
+++ b/afs.c
@@ -512,8 +512,10 @@ static int setup_command_socket_or_die(void)
        unlink(socket_name);
        ret = create_local_socket(socket_name, &unix_addr,
                S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IWOTH);
-       if (ret < 0)
+       if (ret < 0) {
+               PARA_EMERG_LOG("%s: %s\n", PARA_STRERROR(-ret), socket_name);
                exit(EXIT_FAILURE);
+       }
        if (listen(ret , 5) < 0) {
                PARA_EMERG_LOG("%s", "can not listen on socket\n");
                exit(EXIT_FAILURE);
@@ -675,8 +677,8 @@ static void command_post_select(struct sched *s, struct task *t)
                goto out;
        }
        if (t->ret != sizeof(buf)) {
-               PARA_NOTICE_LOG("short read (%d bytes, expected %u)\n",
-                       t->ret, sizeof(buf));
+               PARA_NOTICE_LOG("short read (%d bytes, expected %lu)\n",
+                       t->ret, (long unsigned) sizeof(buf));
                t->ret = 1;
                goto out;
        }