On one of my machines (centos-5.1 based) - my startup log was showing errors 
like this (note the detected binary path):

======================
*** Starting uWSGI 1.0.2.1 (64bit) on [Mon Jan 30 13:45:10 2012] ***
compiled with version: 4.1.2 20071124 (Red Hat 4.1.2-42) on 30 January 2012 
11:24:57
current working directory: /etc/mypub/uwsgi
writing pidfile to /var/run/uwsgi/uwsgi.pid
detected binary path: 
/usr/local/pkg/uwsgi-1.0.2.1/bin/uwsgid=1002,gid=1002,rsize=16384,wsize=57344 0 0
*** WARNING: you are running uWSGI without its master process manager ***
your memory page size is 4096 bytes
*** starting uWSGI Emperor ***
execvp(): No such file or directory [emperor.c line 400]
is the uwsgi binary in your system PATH ?
======================

The error was in uwsgi_get_binary_path() and its usage of readlink() -- from 
the readlink man page (on centos):

       readlink()  places  the contents of the symbolic link path in the buffer 
buf, which has size bufsiz.  readlink() does not append a null byte to buf.  It 
will truncate the contents (to a length of bufsiz characters), in case the 
buffer is too small to  hold  all of the contents.

Adding a null to the end fixes the problem - ala in this snippet (the buf[len] 
line):

===========================
char *uwsgi_get_binary_path(char *argvzero) {

#if defined(__linux__)
        char *buf = uwsgi_malloc(uwsgi.page_size);
        ssize_t len = readlink("/proc/self/exe", buf, uwsgi.page_size);
        if (len > 0) {
                buf[len] = '\0';
                return buf;
        }
        free(buf);




_______________________________________________
uWSGI mailing list
[email protected]
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi

Reply via email to