aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorSteve Price <steve@FreeBSD.org>1998-12-24 18:19:47 +0000
committerSteve Price <steve@FreeBSD.org>1998-12-24 18:19:47 +0000
commita124f32704318569abc0452036ea625e5c642ac2 (patch)
tree9df93609af3860fc7af001a4827f42332dbb62c1 /lib
parentd482d37e815f8b4b4ddeaba63e49713bec1cd2d3 (diff)
Notes
Diffstat (limited to 'lib')
-rw-r--r--lib/csu/amd64/crt1.c12
-rw-r--r--lib/csu/i386-elf/crt1.c12
2 files changed, 18 insertions, 6 deletions
diff --git a/lib/csu/amd64/crt1.c b/lib/csu/amd64/crt1.c
index a30399725f80..d1dd43d0c361 100644
--- a/lib/csu/amd64/crt1.c
+++ b/lib/csu/amd64/crt1.c
@@ -22,13 +22,14 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $Id: crt1.c,v 1.1.1.1 1998/03/07 20:27:10 jdp Exp $
+ * $Id: crt1.c,v 1.2 1998/09/07 23:31:59 jdp Exp $
*/
#ifndef __GNUC__
#error "GCC is needed to compile this file"
#endif
+#include <stddef.h>
#include <stdlib.h>
typedef void (*fptr)(void);
@@ -72,10 +73,15 @@ _start(char *arguments, ...)
argc = * (int *) (argv - 1);
env = argv + argc + 1;
environ = env;
- if(argc > 0)
+ if(argc > 0 && argv[0] != NULL) {
+ char *s;
__progname = argv[0];
+ for (s = __progname; *s != '\0'; s++)
+ if (*s == '/')
+ __progname = s + 1;
+ }
- if(&_DYNAMIC != 0)
+ if(&_DYNAMIC != NULL)
atexit(rtld_cleanup);
#ifdef GCRT
diff --git a/lib/csu/i386-elf/crt1.c b/lib/csu/i386-elf/crt1.c
index a30399725f80..d1dd43d0c361 100644
--- a/lib/csu/i386-elf/crt1.c
+++ b/lib/csu/i386-elf/crt1.c
@@ -22,13 +22,14 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $Id: crt1.c,v 1.1.1.1 1998/03/07 20:27:10 jdp Exp $
+ * $Id: crt1.c,v 1.2 1998/09/07 23:31:59 jdp Exp $
*/
#ifndef __GNUC__
#error "GCC is needed to compile this file"
#endif
+#include <stddef.h>
#include <stdlib.h>
typedef void (*fptr)(void);
@@ -72,10 +73,15 @@ _start(char *arguments, ...)
argc = * (int *) (argv - 1);
env = argv + argc + 1;
environ = env;
- if(argc > 0)
+ if(argc > 0 && argv[0] != NULL) {
+ char *s;
__progname = argv[0];
+ for (s = __progname; *s != '\0'; s++)
+ if (*s == '/')
+ __progname = s + 1;
+ }
- if(&_DYNAMIC != 0)
+ if(&_DYNAMIC != NULL)
atexit(rtld_cleanup);
#ifdef GCRT