exec.c (245426) | exec.c (248980) |
---|---|
1/*- 2 * Copyright (c) 1991, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Kenneth Almquist. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 22 unchanged lines hidden (view full) --- 31 */ 32 33#ifndef lint 34#if 0 35static char sccsid[] = "@(#)exec.c 8.4 (Berkeley) 6/8/95"; 36#endif 37#endif /* not lint */ 38#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 1991, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Kenneth Almquist. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 22 unchanged lines hidden (view full) --- 31 */ 32 33#ifndef lint 34#if 0 35static char sccsid[] = "@(#)exec.c 8.4 (Berkeley) 6/8/95"; 36#endif 37#endif /* not lint */ 38#include <sys/cdefs.h> |
39__FBSDID("$FreeBSD: head/bin/sh/exec.c 245426 2013-01-14 16:40:50Z jilles $"); | 39__FBSDID("$FreeBSD: head/bin/sh/exec.c 248980 2013-04-01 17:18:22Z jilles $"); |
40 41#include <sys/types.h> 42#include <sys/stat.h> 43#include <unistd.h> 44#include <fcntl.h> 45#include <errno.h> 46#include <paths.h> 47#include <stdlib.h> --- 112 unchanged lines hidden (view full) --- 160 n = pread(in, buf, sizeof buf, 0); 161 close(in); 162 if (n > 0 && memchr(buf, '\0', n) != NULL) { 163 errno = ENOEXEC; 164 return; 165 } 166 } 167 *argv = cmd; | 40 41#include <sys/types.h> 42#include <sys/stat.h> 43#include <unistd.h> 44#include <fcntl.h> 45#include <errno.h> 46#include <paths.h> 47#include <stdlib.h> --- 112 unchanged lines hidden (view full) --- 160 n = pread(in, buf, sizeof buf, 0); 161 close(in); 162 if (n > 0 && memchr(buf, '\0', n) != NULL) { 163 errno = ENOEXEC; 164 return; 165 } 166 } 167 *argv = cmd; |
168 *--argv = _PATH_BSHELL; | 168 *--argv = __DECONST(char *, _PATH_BSHELL); |
169 execve(_PATH_BSHELL, argv, envp); 170 } 171 errno = e; 172} 173 174/* 175 * Do a path search. The variable path (passed by reference) should be 176 * set to the start of the path before the first call; padvance will update --- 6 unchanged lines hidden (view full) --- 183 184const char *pathopt; 185 186char * 187padvance(const char **path, const char *name) 188{ 189 const char *p, *start; 190 char *q; | 169 execve(_PATH_BSHELL, argv, envp); 170 } 171 errno = e; 172} 173 174/* 175 * Do a path search. The variable path (passed by reference) should be 176 * set to the start of the path before the first call; padvance will update --- 6 unchanged lines hidden (view full) --- 183 184const char *pathopt; 185 186char * 187padvance(const char **path, const char *name) 188{ 189 const char *p, *start; 190 char *q; |
191 int len; | 191 size_t len; |
192 193 if (*path == NULL) 194 return NULL; 195 start = *path; 196 for (p = start; *p && *p != ':' && *p != '%'; p++) 197 ; /* nothing */ 198 len = p - start + strlen(name) + 2; /* "2" is for '/' and '\0' */ 199 STARTSTACKSTR(q); --- 568 unchanged lines hidden --- | 192 193 if (*path == NULL) 194 return NULL; 195 start = *path; 196 for (p = start; *p && *p != ':' && *p != '%'; p++) 197 ; /* nothing */ 198 len = p - start + strlen(name) + 2; /* "2" is for '/' and '\0' */ 199 STARTSTACKSTR(q); --- 568 unchanged lines hidden --- |