mirror of
https://github.com/freebsd/freebsd-src
synced 2024-09-06 17:18:32 +00:00
kldconfig: Remove some code for compatibility with FreeBSD 4.x.
Verified using md5(1).
This commit is contained in:
parent
41f554961d
commit
fcc482b365
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=262946
|
@ -40,15 +40,6 @@ __FBSDID("$FreeBSD$");
|
|||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#if defined(__FreeBSD_version)
|
||||
#if __FreeBSD_version < 500000
|
||||
#define NEED_SLASHTERM
|
||||
#endif /* < 500000 */
|
||||
#else /* defined(__FreeBSD_version) */
|
||||
/* just in case.. */
|
||||
#define NEED_SLASHTERM
|
||||
#endif /* defined(__FreeBSD_version) */
|
||||
|
||||
/* the default sysctl name */
|
||||
#define PATHCTL "kern.module_path"
|
||||
|
||||
|
@ -163,18 +154,9 @@ addpath(struct pathhead *pathq, char *path, int force, int insert)
|
|||
strlcpy(pathbuf, path, sizeof(pathbuf));
|
||||
|
||||
len = strlen(pathbuf);
|
||||
#ifdef NEED_SLASHTERM
|
||||
/* slash-terminate, because the kernel linker said so. */
|
||||
if ((len == 0) || (pathbuf[len-1] != '/')) {
|
||||
if (len == sizeof(pathbuf) - 1)
|
||||
errx(1, "path too long: %s", pathbuf);
|
||||
pathbuf[len] = '/';
|
||||
}
|
||||
#else /* NEED_SLASHTERM */
|
||||
/* remove a terminating slash if present */
|
||||
if ((len > 0) && (pathbuf[len-1] == '/'))
|
||||
pathbuf[--len] = '\0';
|
||||
#endif /* NEED_SLASHTERM */
|
||||
|
||||
/* is it already in there? */
|
||||
TAILQ_FOREACH(pe, pathq, next)
|
||||
|
@ -219,18 +201,9 @@ rempath(struct pathhead *pathq, char *path, int force, int insert __unused)
|
|||
strlcpy(pathbuf, path, sizeof(pathbuf));
|
||||
|
||||
len = strlen(pathbuf);
|
||||
#ifdef NEED_SLASHTERM
|
||||
/* slash-terminate, because the kernel linker said so. */
|
||||
if ((len == 0) || (pathbuf[len-1] != '/')) {
|
||||
if (len == sizeof(pathbuf) - 1)
|
||||
errx(1, "path too long: %s", pathbuf);
|
||||
pathbuf[len] = '/';
|
||||
}
|
||||
#else /* NEED_SLASHTERM */
|
||||
/* remove a terminating slash if present */
|
||||
if ((len > 0) && (pathbuf[len-1] == '/'))
|
||||
pathbuf[--len] = '\0';
|
||||
#endif /* NEED_SLASHTERM */
|
||||
|
||||
/* Is it in there? */
|
||||
TAILQ_FOREACH(pe, pathq, next)
|
||||
|
|
Loading…
Reference in a new issue