#undef _PATH_DEFPATH_ROOT
#define _PATH_DEFPATH_ROOT "/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin"
-#define _PATH_TTY "/dev/tty"
#define _PATH_SECURETTY "/etc/securetty"
#define _PATH_WTMPLOCK "/etc/wtmplock"
#define _PATH_MOUNTED_LOCK _PATH_MOUNTED "~"
#define _PATH_MOUNTED_TMP _PATH_MOUNTED ".tmp"
+#ifndef _PATH_DEV
+# define _PATH_DEV "/dev"
+#endif
+
+#define _PATH_DEV_LOOP "/dev/loop"
+#define _PATH_DEV_TTY "/dev/tty"
+
/* udev paths */
#define _PATH_DEV_BYLABEL "/dev/disk/by-label"
#define _PATH_DEV_BYUUID "/dev/disk/by-uuid"
int ask, fflag, hflag, pflag, cnt, errsv;
int quietlog, passwd_req;
char *domain, *ttyn;
- char tbuf[MAXPATHLEN + 2], tname[sizeof(_PATH_TTY) + 10];
+ char tbuf[MAXPATHLEN + 2], tname[sizeof(_PATH_DEV_TTY) + 10];
char *termenv;
char *childArgv[10];
char *buff;
if (ttyn == NULL || *ttyn == '\0') {
/* no snprintf required - see definition of tname */
- sprintf(tname, "%s??", _PATH_TTY);
+ snprintf(tname, sizeof(tname), "%s??", _PATH_DEV_TTY);
ttyn = tname;
}
#if 0
int t;
- t = open(_PATH_TTY, O_RDWR);
+ t = open(_PATH_DEV_TTY, O_RDWR);
if (t >= 0) {
(void) ioctl(t, TIOCNOTTY, (char *)0);
(void) close(t);
return 0;
}
-#define DEV_LOOP_PATH "/dev/loop"
-#define DEV_PATH "/dev"
#define LOOPMAJOR 7
#define NLOOPS_DEFAULT 8 /* /dev/loop[0-7] */
ll->flag = flag;
ll->ncur = -1;
- if (stat(DEV_PATH, &st) == -1 || (!S_ISDIR(st.st_mode)))
+ if (stat(_PATH_DEV, &st) == -1 || (!S_ISDIR(st.st_mode)))
return -1; /* /dev doesn't exist */
- if (stat(DEV_LOOP_PATH, &st) == 0 && S_ISDIR(st.st_mode))
+ if (stat(_PATH_DEV_LOOP, &st) == 0 && S_ISDIR(st.st_mode))
ll->flag |= LLFLG_SUBDIR; /* /dev/loop/ exists */
if ((ll->flag & LLFLG_USEDONLY) &&
/* create a full device path */
snprintf(ll->name, sizeof(ll->name),
ll->flag & LLFLG_SUBDIR ?
- DEV_LOOP_PATH "/%d" :
- DEV_PATH "/loop%d",
+ _PATH_DEV_LOOP "/%d" :
+ _PATH_DEV "/loop%d",
lnum);
fd = open(ll->name, O_RDONLY);
*/
if (!ll->minors) {
ll->nminors = (ll->flag & LLFLG_SUBDIR) ?
- loop_scandir(DEV_LOOP_PATH, &ll->minors, 0) :
- loop_scandir(DEV_PATH, &ll->minors, 1);
+ loop_scandir(_PATH_DEV_LOOP, &ll->minors, 0) :
+ loop_scandir(_PATH_DEV, &ll->minors, 1);
ll->ncur = -1;
}
for (++ll->ncur; ll->ncur < ll->nminors; ll->ncur++) {
#include "mount_constants.h"
#include "sundries.h"
#include "getusername.h"
+#include "pathnames.h"
#include "lomount.h"
#include "loop.h"
#include "fstab.h"
char *p;
/* check if it begins with /dev/loop */
- if (strncmp(mc->m.mnt_fsname, "/dev/loop", 9))
+ if (strncmp(mc->m.mnt_fsname, _PATH_DEV_LOOP,
+ sizeof(_PATH_DEV_LOOP) - 1))
return 0;
/* check for loop option in fstab */
_PATH_DEFPATH /usr/local/bin:/bin:/usr/bin
_PATH_DEFPATH_ROOT /usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
- _PATH_TTY /dev/tty
+ _PATH_DEV_TTY /dev/tty
+ _PATH_DEV_LOOP /dev/loop
_PATH_SECURETTY /etc/securetty
_PATH_WTMPLOCK /etc/wtmplock
_PATH_HUSHLOGIN .hushlogin
{
DEF_HLPPATH(_PATH_DEFPATH),
DEF_HLPPATH(_PATH_DEFPATH_ROOT),
- DEF_HLPPATH(_PATH_TTY),
+ DEF_HLPPATH(_PATH_DEV_TTY),
+ DEF_HLPPATH(_PATH_DEV_LOOP),
DEF_HLPPATH(_PATH_SECURETTY),
DEF_HLPPATH(_PATH_WTMPLOCK),
DEF_HLPPATH(_PATH_HUSHLOGIN),