Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Message from discussion non-root binary distribution
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
nobu.nokada  
View profile  
 More options Mar 4 2004, 11:40 am
Newsgroups: comp.lang.ruby
From: nobu.nok...@softhome.net
Date: Fri, 5 Mar 2004 01:35:44 +0900
Local: Thurs, Mar 4 2004 11:35 am
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 <stdio.h>
> #include <errno.h>

> 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


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google