Comment 1 for bug 57632

Revision history for this message
Michael Bienia (geser) wrote :

Here is a patch

--- coolmail-1.3.orig/coolmail.c
+++ coolmail-1.3/coolmail.c
@@ -26,6 +26,7 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
+#include <pwd.h>

 #ifdef AUDIO
 #include <string.h>
@@ -96,7 +97,7 @@
 int main(int argc, char *argv[])
 {
    int reason;
- char username[L_cuserid];
+ struct passwd *uid;

    /* Quickly scan for the -h option -- if it is present don't do anything
     * but print out some help and exit. */
@@ -104,7 +105,11 @@
       return(0);

    /* Get the username and use it to create a default mailfile name */
- strcat(mailfile_str, cuserid(username));
+ if (!(uid = getpwuid(geteuid()))) {
+ printf("Couldn't determine your username. Exiting.\n");
+ return 1;
+ }
+ strcat(mailfile_str, uid->pw_name);

    /* Initialize the renderer */
    rend_init(&argc, argv, (float)150.0);