Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 21 Jul 2003 11:24:43 -0700
From:      Tim Kientzle <kientzle@acm.org>
To:        Chad David <davidc@issci.ca>
Cc:        hackers@freebsd.org
Subject:   Re: Correct way to call execve?
Message-ID:  <3F1C2FEB.4070801@acm.org>
References:  <3F1B0610.90803@acm.org> <20030720225041.GA26277@ussenterprise.ufp.org> <3F1C0C91.6050203@acm.org> <20030721165735.GA56766@ussenterprise.ufp.org> <20030721171538.GA21656@colnta.acns.ab.ca> <20030721172321.GA57666@ussenterprise.ufp.org> <20030721174206.GA21892@colnta.acns.ab.ca>

next in thread | previous in thread | raw e-mail | index | archive | help
Chad David wrote:
> I assumed it was obvious that you could copy the data, but I believe
> the intent of the original question was to find an alternative.  As
> far as I know there isn't one.  A const is a const, except in C++.

Yes, the intent was to find a way to avoid copying the data.

I was hoping that someone knew a standard way to
say "yes, I really do mean to cast away that const,"
akin to C++ const_cast.

As far as I can tell, the POSIX-mandated declaration
of execvp is simply wrong.  (SUSv3 even has a comment
that essentially admits this fact and then vainly tries
to rationalize it.  <sigh>)

Basically, there is no const-correct way to
invoke execvp using literal strings for argv except
to copy the strings.  In particular, the
FreeBSD implementation of popen(), for example, cannot be
compiled with strict warnings.

Tim



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3F1C2FEB.4070801>