Re: your mail
Posted in 1992
Quoting jwt@ulysses.att.com... > > I have some problem on my INFORMIX-4GL upgrade, > we got the new 4.1 from INFORMIX last month, we had the 1.10 before. > It's not the upgrade... > I have a C function that 4GL program called to get the user ID, it works > fine on the 1.10, but when I run it on the 4.1, it gets core dump, the message > is "Memory fault(coredump)" > It's the C function! > My C program is > > #include <sys/types.h> > #include <pwd.h> > get_userid() > { > struct passwd *user_info, *getpwuid(); > char user_id[11]; > int uid; > > popquote(user_id,11); > uid = getuid(); > user_info = getpwuid(uid); > strcpy(user_id, user_info->pw_name); > retquote(user_id); > return(1); > } > > my 4gl program is > > database cna > define user_id char(11) > > main > call get_userid() returning user_id > display user_id > end main > What is happening is the C function is popping a value off the stack that was never placed on there. Try this C function out... get_userid(arg) int arg; { struct passwd *getpwuid(), *user_info; unsigned short getuid(); user_info = getpwuid((int)getuid()); retquote(user_info->pw_name); return(1); } Use this line in your 4GL program LET user_id = get_userid() DAS -- David A. Snyder @ Snide Inc. - Folcroft, PA Current Release is db4glgen-3.3 UUCP: ..!uunet!das13!dave INTERNET: Dave.Snyder@snide.com