From: nobu.nokada@... Date: 2004-03-05T01:35:44+09:00 Subject: Re: non-root binary distribution Hi, At Fri, 5 Mar 2004 00:51:39 +0900, David Garamond wrote in [ruby-talk:94230]: > Based on your suggestion, I've created a C wrapper like below. The real > ruby is renamed to "ruby.real". Advice welcome, since this is probably > only the 7th or 8th C program I've written, ever. :-) I recommend static-linked binary after all. You'd have no merit of shared library at all if you put the copy in each users' space. > #include > #include > > int main(int argc, char *argv[]) { > static char binpath[512+5], libpath[512+6]; You'd better to get rid of magic numbers. > p = (char *)getenv("LD_LIBRARY_PATH"); > if ((env = (char *)malloc(512+1+(p==NULL ? 0:strlen(p)))) == NULL) { > fprintf(stderr, "malloc() failed: %s\n", strerror(errno)); > exit(1); > } > strcat(env, "LD_LIBRARY_PATH="); Use strcpy instead of strcat here, content of malloc'ed area is not guaranteed. -- Nobu Nakada