look at getpwnam manpage, and change the program to not use static user ids.
to rely on a static user id other than root(0) should be threaded as bug.
it's pretty easy to do dynamic stuff:
#include <pwd.h>
#include <sys/types.h>
...
struct passwd *pw;
pw = getpwnam("myuser");
if (pw == NULL) {
// error handling
}
uid = pw->pw_uid;
...
andreas