[AD] static link

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


making a new thread at Elias's request.

Allegro appears to shutdown on line 2819 of xwin.c:
pass = getpwuid(geteuid());

Commenting out this line, and the next few lines of code that use pass, make the crash go away. Taking out getpwuid actually stops the crash as well. I dont know why getpwuid would crash the program. Putting these lines in a standalone program and linking with -static dont crash it so I dont see what allegro is doing differently.
BTW, pwd.h is wrapped in an ifdef, but the code that uses pwd isnt:
#ifdef ALLEGRO_XWINDOWS_WITH_XF86DGA
#include <pwd.h>
#endif

/* missing #ifdef ALLEGRO_XWINDOWS_WITH_XF86DGA
*/
/* Test that user has enough privileges.  */
  pass = getpwuid(geteuid());
  if (pass == 0) {
ustrzcpy(allegro_error, ALLEGRO_ERROR_SIZE, get_config_text("Can not obtain user name"));
     return 0;
  }
  if (strcmp("root", pass->pw_name) != 0) {
ustrzcpy(allegro_error, ALLEGRO_ERROR_SIZE, get_config_text("This driver needs root privileges"));
     return 0;
  }

I would write a patch for this, but if the getpwuid(geteuid()) lines are going to change then it would be for naught. Keep in mind this crash only occurs when linking with -static `allegro-config --static`




Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/