On Fri, Jan 26, 2007 at 10:52:39AM +0100, Sven Luther wrote:
Next step would be :

 1) write a program writing to stdout and dropping the actual error message
 somewhere.

How about this:

#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>

#define LOGFILE "/stdouttest.log"
#define TESTMSG "This is a test string\n"

int
main(int argc, char **argv, char **envp)
{
        FILE *logfile;
        int printerrno;
        char *printerror;
        int retval = EXIT_FAILURE;
        int result;

        /* Setup a log file */
        logfile = fopen(LOGFILE, "a");
        if (!logfile)
                exit(retval);
        
fprintf(logfile, "Program %s started\n", argv[0]);
        /* Print to stdout */
        result = fprintf(stdout, TESTMSG);

        /* Log results */
        if (result < 0) {
                printerrno = errno;
                printerror = strerror(printerrno);
                fprintf(logfile, "Printing failed (%i): %s\n",
                        printerrno, printerror);
        } else if (result < strlen(TESTMSG)) {
                fprintf(logfile, "Printing was truncated to %i bytes\n", 
result);
        } else {
                fprintf(logfile, "Printing successful\n");
                retval = EXIT_SUCCESS;
        }

        /* We're done */
        fclose(logfile);
        exit(retval);
}


 2) contact udev author and ask for his help, since Marco said he didn't have
 a further clue, and this may be an upstream problem.

Sounds like a good idea...the upstream mailing list is very active.

--
David Härdeman

Reply via email to