fix potential segfault in para_client
[paraslash.git] / recv.c
diff --git a/recv.c b/recv.c
index aaccb06ac77fcd7bded8ffc46c300039227eabe1..fd82bc0fa6d998e51072284aefe1dc5d79dd3663 100644 (file)
--- a/recv.c
+++ b/recv.c
@@ -15,7 +15,6 @@
  *     along with this program; if not, write to the Free Software
  *     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
  */
-#include "gcc-compat.h"
 #include "para.h"
 
 #include "recv.h"
@@ -26,7 +25,7 @@ struct gengetopt_args_info conf;
 
 INIT_RECV_ERRLISTS;
 
-__printf_2_3 void para_log(int ll, char* fmt,...)
+__printf_2_3 void para_log(int ll, const char* fmt,...)
 {
        va_list argp;
 
@@ -48,7 +47,8 @@ static void *parse_config(int argc, char *argv[], int *receiver_num)
                printf("available receivers: ");
                for (i = 0; receivers[i].name; i++)
                        printf("%s%s", i? " " : "", receivers[i].name);
-               printf("\nTry para_recv -r<receivername>:-h for help on <receivername>\n");
+               printf("\nTry\n\tpara_recv -r '<receivername> -h'\n"
+                       "for help on <receivername>.\n");
                exit(EXIT_SUCCESS);
        }
        return check_receiver_arg(conf.receiver_arg, receiver_num);
@@ -105,13 +105,13 @@ recv:
                goto recv;
        }
        ret = write(STDOUT_FILENO, rn.buf, rn.loaded);
-       PARA_DEBUG_LOG("wrote %d/%d\n", ret, rn.loaded);
+       PARA_DEBUG_LOG("wrote %d/%zd\n", ret, rn.loaded);
        if (ret < 0) {
                ret = -E_WRITE_STDOUT;
                goto out;
        }
        if (ret != rn.loaded) {
-               PARA_INFO_LOG("short write %d/%d\n", ret, rn.loaded);
+               PARA_INFO_LOG("short write %d/%zd\n", ret, rn.loaded);
                memmove(rn.buf, rn.buf + ret, rn.loaded - ret);
        }
        rn.loaded -= ret;
@@ -123,6 +123,6 @@ out:
        if (r)
                r->shutdown();
        if (ret < 0)
-               PARA_NOTICE_LOG("%d: (%s)\n", ret, PARA_STRERROR(-ret));
+               PARA_ERROR_LOG("%s\n", PARA_STRERROR(-ret));
        return ret;
 }