CVS commit: src/usr.sbin/autofs
Module Name:src Committed By: tkusumi Date: Wed May 4 11:27:54 UTC 2022 Modified Files: src/usr.sbin/autofs: automount.c common.c Log Message: usr.sbin/autofs: Fix absolute path when creating a mountpoint taken-from freebsd 63640b2f552c0476f50484635eb9888eafcd22dc To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/usr.sbin/autofs/automount.c cvs rdiff -u -r1.4 -r1.5 src/usr.sbin/autofs/common.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/autofs/automount.c diff -u src/usr.sbin/autofs/automount.c:1.3 src/usr.sbin/autofs/automount.c:1.4 --- src/usr.sbin/autofs/automount.c:1.3 Mon Jan 15 14:38:06 2018 +++ src/usr.sbin/autofs/automount.c Wed May 4 11:27:54 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: automount.c,v 1.3 2018/01/15 14:38:06 christos Exp $ */ +/* $NetBSD: automount.c,v 1.4 2022/05/04 11:27:54 tkusumi Exp $ */ /*- * Copyright (c) 2017 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ * SUCH DAMAGE. */ #include -__RCSID("$NetBSD: automount.c,v 1.3 2018/01/15 14:38:06 christos Exp $"); +__RCSID("$NetBSD: automount.c,v 1.4 2022/05/04 11:27:54 tkusumi Exp $"); #include #include @@ -83,18 +83,8 @@ mount_autofs(const char *from, const cha { struct autofs_args args; int error; - char *cwd; - /* - * There is no guarantee we are at /, so chdir to /. - */ - cwd = getcwd(NULL, 0); - if (chdir("/") != 0) - log_warn("failed to chdir to /"); create_directory(fspath); - if (chdir(cwd) != 0) - log_warn("failed to restore cwd"); - free(cwd); log_debugx("mounting %s on %s, prefix \"%s\", options \"%s\"", from, fspath, prefix, options); Index: src/usr.sbin/autofs/common.c diff -u src/usr.sbin/autofs/common.c:1.4 src/usr.sbin/autofs/common.c:1.5 --- src/usr.sbin/autofs/common.c:1.4 Tue Sep 14 20:40:55 2021 +++ src/usr.sbin/autofs/common.c Wed May 4 11:27:54 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: common.c,v 1.4 2021/09/14 20:40:55 rillig Exp $ */ +/* $NetBSD: common.c,v 1.5 2022/05/04 11:27:54 tkusumi Exp $ */ /*- * Copyright (c) 2017 The NetBSD Foundation, Inc. @@ -36,7 +36,7 @@ * $FreeBSD: head/usr.sbin/autofs/common.c 303527 2016-07-30 01:10:05Z bapt $ */ #include -__RCSID("$NetBSD: common.c,v 1.4 2021/09/14 20:40:55 rillig Exp $"); +__RCSID("$NetBSD: common.c,v 1.5 2022/05/04 11:27:54 tkusumi Exp $"); #include #include @@ -132,7 +132,7 @@ create_directory(const char *path) */ copy = tofree = checked_strdup(path + 1); - partial = checked_strdup(""); + partial = checked_strdup("/"); for (;;) { component = strsep(©, "/"); if (component == NULL)
CVS commit: src/usr.sbin/autofs
Module Name:src Committed By: tkusumi Date: Wed May 4 11:27:54 UTC 2022 Modified Files: src/usr.sbin/autofs: automount.c common.c Log Message: usr.sbin/autofs: Fix absolute path when creating a mountpoint taken-from freebsd 63640b2f552c0476f50484635eb9888eafcd22dc To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/usr.sbin/autofs/automount.c cvs rdiff -u -r1.4 -r1.5 src/usr.sbin/autofs/common.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.sbin/autofs
Module Name:src Committed By: rillig Date: Tue Sep 14 20:40:55 UTC 2021 Modified Files: src/usr.sbin/autofs: common.c Log Message: autofs: fix lint errors common.c(1034): error: void function parse_map cannot return value [213] common.c(1053): error: void function parse_map cannot return value [213] To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/usr.sbin/autofs/common.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.sbin/autofs
Module Name:src Committed By: rillig Date: Tue Sep 14 20:40:55 UTC 2021 Modified Files: src/usr.sbin/autofs: common.c Log Message: autofs: fix lint errors common.c(1034): error: void function parse_map cannot return value [213] common.c(1053): error: void function parse_map cannot return value [213] To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/usr.sbin/autofs/common.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/autofs/common.c diff -u src/usr.sbin/autofs/common.c:1.3 src/usr.sbin/autofs/common.c:1.4 --- src/usr.sbin/autofs/common.c:1.3 Sat Nov 16 12:21:06 2019 +++ src/usr.sbin/autofs/common.c Tue Sep 14 20:40:55 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: common.c,v 1.3 2019/11/16 12:21:06 tkusumi Exp $ */ +/* $NetBSD: common.c,v 1.4 2021/09/14 20:40:55 rillig Exp $ */ /*- * Copyright (c) 2017 The NetBSD Foundation, Inc. @@ -36,7 +36,7 @@ * $FreeBSD: head/usr.sbin/autofs/common.c 303527 2016-07-30 01:10:05Z bapt $ */ #include -__RCSID("$NetBSD: common.c,v 1.3 2019/11/16 12:21:06 tkusumi Exp $"); +__RCSID("$NetBSD: common.c,v 1.4 2021/09/14 20:40:55 rillig Exp $"); #include #include @@ -1031,7 +1031,8 @@ parse_map(struct node *parent, const cha if (map[0] == '-') { if (wildcards != NULL) *wildcards = true; - return parse_special_map(parent, map, key); + parse_special_map(parent, map, key); + return; } if (map[0] == '/') { @@ -1050,7 +1051,8 @@ parse_map(struct node *parent, const cha if (error != 0) { log_debugx("map file \"%s\" does not exist; falling " "back to directory services", path); - return parse_included_map(parent, map); + parse_included_map(parent, map); + return; } }
CVS commit: src/usr.sbin/autofs
Module Name:src Committed By: tkusumi Date: Mon Nov 25 16:57:09 UTC 2019 Modified Files: src/usr.sbin/autofs: automountd.8 Log Message: autofs: Add missing description for automountd option -T To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/usr.sbin/autofs/automountd.8 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.sbin/autofs
Module Name:src Committed By: tkusumi Date: Mon Nov 25 16:57:09 UTC 2019 Modified Files: src/usr.sbin/autofs: automountd.8 Log Message: autofs: Add missing description for automountd option -T To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/usr.sbin/autofs/automountd.8 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/autofs/automountd.8 diff -u src/usr.sbin/autofs/automountd.8:1.4 src/usr.sbin/autofs/automountd.8:1.5 --- src/usr.sbin/autofs/automountd.8:1.4 Thu Nov 21 15:24:17 2019 +++ src/usr.sbin/autofs/automountd.8 Mon Nov 25 16:57:09 2019 @@ -1,4 +1,4 @@ -.\" $NetBSD: automountd.8,v 1.4 2019/11/21 15:24:17 tkusumi Exp $ +.\" $NetBSD: automountd.8,v 1.5 2019/11/25 16:57:09 tkusumi Exp $ .\" .\" Copyright (c) 2017 The NetBSD Foundation, Inc. .\" Copyright (c) 2016 The DragonFly Project @@ -34,7 +34,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 25, 2017 +.Dd November 26, 2019 .Dt AUTOMOUNTD 8 .Os .Sh NAME @@ -85,6 +85,9 @@ The default is 30. Specify mount options. Options specified here will be overridden by options entered in maps or .Xr auto_master 5 . +.It Fl T +Increase verbosity. +For compatibility with other implementations, such as OS X. .It Fl v Increase verbosity. .El
CVS commit: src/usr.sbin/autofs
Module Name:src Committed By: tkusumi Date: Thu Nov 21 16:45:05 UTC 2019 Modified Files: src/usr.sbin/autofs: autounmountd.c Log Message: autofs: Change autounmountd(8) to use time_t for duration instead of double The commit log from FreeBSD. -- autounmountd(8) uses doubles to handle mount time durations. However, it must convert to integer types, time_t in particular, to do anything meaningful. Additionally, even though it's a floating-point value in seconds, the sub-seconds component is never used, so it's unnecessary. Switching type to time_t fixes an assertion on powerpc64, which checks that a sleep value that's not -1.0 is greater than 0. On powerpc64, it happens that the value of -1.0 gets loaded as a float (perhaps a bug in gcc), but gets compared to a double. This compares as false, so follows through the 'sleep != -1.0' path, and fails the assert. Since the sub-second component isn't used in the double, just drop it and deal with whole-integer seconds. -- Taken-from: FreeBSD and DragonFlyBSD To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/usr.sbin/autofs/autounmountd.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.sbin/autofs
Module Name:src Committed By: tkusumi Date: Thu Nov 21 16:45:05 UTC 2019 Modified Files: src/usr.sbin/autofs: autounmountd.c Log Message: autofs: Change autounmountd(8) to use time_t for duration instead of double The commit log from FreeBSD. -- autounmountd(8) uses doubles to handle mount time durations. However, it must convert to integer types, time_t in particular, to do anything meaningful. Additionally, even though it's a floating-point value in seconds, the sub-seconds component is never used, so it's unnecessary. Switching type to time_t fixes an assertion on powerpc64, which checks that a sleep value that's not -1.0 is greater than 0. On powerpc64, it happens that the value of -1.0 gets loaded as a float (perhaps a bug in gcc), but gets compared to a double. This compares as false, so follows through the 'sleep != -1.0' path, and fails the assert. Since the sub-second component isn't used in the double, just drop it and deal with whole-integer seconds. -- Taken-from: FreeBSD and DragonFlyBSD To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/usr.sbin/autofs/autounmountd.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/autofs/autounmountd.c diff -u src/usr.sbin/autofs/autounmountd.c:1.1 src/usr.sbin/autofs/autounmountd.c:1.2 --- src/usr.sbin/autofs/autounmountd.c:1.1 Tue Jan 9 03:31:15 2018 +++ src/usr.sbin/autofs/autounmountd.c Thu Nov 21 16:45:05 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: autounmountd.c,v 1.1 2018/01/09 03:31:15 christos Exp $ */ +/* $NetBSD: autounmountd.c,v 1.2 2019/11/21 16:45:05 tkusumi Exp $ */ /*- * Copyright (c) 2017 The NetBSD Foundation, Inc. @@ -35,7 +35,7 @@ * */ #include -__RCSID("$NetBSD: autounmountd.c,v 1.1 2018/01/09 03:31:15 christos Exp $"); +__RCSID("$NetBSD: autounmountd.c,v 1.2 2019/11/21 16:45:05 tkusumi Exp $"); #include #include @@ -175,12 +175,12 @@ do_unmount(const fsid_t fsid __unused, c return error; } -static double -expire_automounted(double expiration_time) +static time_t +expire_automounted(time_t expiration_time) { struct automounted_fs *af, *tmpaf; time_t now; - double mounted_for, mounted_max = -1.0; + time_t mounted_for, mounted_max = -1; int error; now = time(NULL); @@ -188,14 +188,14 @@ expire_automounted(double expiration_tim log_debugx("expiring automounted filesystems"); TAILQ_FOREACH_SAFE(af, &automounted, af_next, tmpaf) { - mounted_for = difftime(now, af->af_mount_time); + mounted_for = (time_t)difftime(now, af->af_mount_time); if (mounted_for < expiration_time) { log_debugx("skipping %s (FSID:%d:%d), mounted " - "for %.0f seconds", af->af_mountpoint, + "for %jd seconds", af->af_mountpoint, af->af_fsid.__fsid_val[0], af->af_fsid.__fsid_val[1], - mounted_for); + (intmax_t)mounted_for); if (mounted_for > mounted_max) mounted_max = mounted_for; @@ -204,9 +204,9 @@ expire_automounted(double expiration_tim } log_debugx("filesystem mounted on %s (FSID:%d:%d), " - "was mounted for %.0f seconds; unmounting", + "was mounted for %jd seconds; unmounting", af->af_mountpoint, af->af_fsid.__fsid_val[0], - af->af_fsid.__fsid_val[1], mounted_for); + af->af_fsid.__fsid_val[1], (intmax_t)mounted_for); error = do_unmount(af->af_fsid, af->af_mountpoint); if (error != 0) { if (mounted_for > mounted_max) @@ -227,19 +227,19 @@ usage_autounmountd(void) } static void -do_wait(int kq, double sleep_time) +do_wait(int kq, time_t sleep_time) { struct timespec timeout; struct kevent unused; int nevents; - if (sleep_time != -1.0) { - assert(sleep_time > 0.0); + if (sleep_time != -1) { + assert(sleep_time > 0); timeout.tv_sec = (int)sleep_time; timeout.tv_nsec = 0; - log_debugx("waiting for filesystem event for %.0f seconds", - sleep_time); + log_debugx("waiting for filesystem event for %jd seconds", + (intmax_t)sleep_time); nevents = kevent(kq, NULL, 0, &unused, 1, &timeout); } else { log_debugx("waiting for filesystem event"); @@ -253,7 +253,7 @@ do_wait(int kq, double sleep_time) if (nevents == 0) { log_debugx("timeout reached"); - assert(sleep_time > 0.0); + assert(sleep_time > 0); } else { log_debugx("got filesystem event"); } @@ -264,7 +264,7 @@ main_autounmountd(int argc, char **argv) { struct kevent event; int ch, debug = 0, error, kq; - double expiration_time = 600, retry_time = 600, mounted_max, sleep_time; + time_t expiration_time = 600, retry_time = 600, mounted_max, sleep_time; bool dont_daemonize = false; while ((ch = getopt(argc, argv, "dr:t:v")) != -1) { @@ -333,19 +333,18 @@ main_autounmountd(int argc, char **argv) for (;;) { refresh_automounted(); mounted_max = expire_automounted(expiration_time); - if (mounted_max == -1.0) { + if (mounted_max == -1) { sleep_time = mounted_max; l
CVS commit: src/usr.sbin/autofs
Module Name:src Committed By: tkusumi Date: Sat Nov 16 12:26:54 UTC 2019 Modified Files: src/usr.sbin/autofs: auto_master.5 defined.c Log Message: autofs: Support DOLLAR for $ literal taken-from FreeBSD and DragonFlyBSD To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/usr.sbin/autofs/auto_master.5 cvs rdiff -u -r1.1 -r1.2 src/usr.sbin/autofs/defined.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/autofs/auto_master.5 diff -u src/usr.sbin/autofs/auto_master.5:1.6 src/usr.sbin/autofs/auto_master.5:1.7 --- src/usr.sbin/autofs/auto_master.5:1.6 Thu Jan 25 19:15:10 2018 +++ src/usr.sbin/autofs/auto_master.5 Sat Nov 16 12:26:54 2019 @@ -1,4 +1,4 @@ -.\" $NetBSD: auto_master.5,v 1.6 2018/01/25 19:15:10 uwe Exp $ +.\" $NetBSD: auto_master.5,v 1.7 2019/11/16 12:26:54 tkusumi Exp $ .\" Copyright (c) 2017 The NetBSD Foundation, Inc. .\" Copyright (c) 2016 The DragonFly Project .\" Copyright (c) 2014 The FreeBSD Foundation @@ -33,7 +33,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 25, 2017 +.Dd November 16, 2019 .Dt AUTO_MASTER 5 .Os .Sh NAME @@ -195,6 +195,8 @@ Expands to the output of .It Dv CPU Same as .Dv ARCH . +.It Dv DOLLAR +A literal $ sign. .It Dv HOST Expands to the output of .Li "uname -n" . Index: src/usr.sbin/autofs/defined.c diff -u src/usr.sbin/autofs/defined.c:1.1 src/usr.sbin/autofs/defined.c:1.2 --- src/usr.sbin/autofs/defined.c:1.1 Tue Jan 9 03:31:15 2018 +++ src/usr.sbin/autofs/defined.c Sat Nov 16 12:26:54 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: defined.c,v 1.1 2018/01/09 03:31:15 christos Exp $ */ +/* $NetBSD: defined.c,v 1.2 2019/11/16 12:26:54 tkusumi Exp $ */ /*- * Copyright (c) 2017 The NetBSD Foundation, Inc. @@ -35,7 +35,7 @@ * */ #include -__RCSID("$NetBSD: defined.c,v 1.1 2018/01/09 03:31:15 christos Exp $"); +__RCSID("$NetBSD: defined.c,v 1.2 2019/11/16 12:26:54 tkusumi Exp $"); /* * All the "defined" stuff is for handling variables, @@ -256,6 +256,7 @@ defined_init(void) defined_add("ARCH", name.machine); defined_add("CPU", name.machine); + defined_add("DOLLAR", "$"); defined_add("HOST", name.nodename); defined_add("OSNAME", name.sysname); defined_add("OSREL", name.release);
CVS commit: src/usr.sbin/autofs
Module Name:src Committed By: tkusumi Date: Sat Nov 16 12:26:54 UTC 2019 Modified Files: src/usr.sbin/autofs: auto_master.5 defined.c Log Message: autofs: Support DOLLAR for $ literal taken-from FreeBSD and DragonFlyBSD To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/usr.sbin/autofs/auto_master.5 cvs rdiff -u -r1.1 -r1.2 src/usr.sbin/autofs/defined.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.sbin/autofs
Module Name:src Committed By: tkusumi Date: Sat Nov 16 12:21:06 UTC 2019 Modified Files: src/usr.sbin/autofs: common.c Log Message: autofs: Fix segfault that could occur on "automount -LL" To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/usr.sbin/autofs/common.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/autofs/common.c diff -u src/usr.sbin/autofs/common.c:1.2 src/usr.sbin/autofs/common.c:1.3 --- src/usr.sbin/autofs/common.c:1.2 Sat Nov 16 11:56:29 2019 +++ src/usr.sbin/autofs/common.c Sat Nov 16 12:21:06 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: common.c,v 1.2 2019/11/16 11:56:29 tkusumi Exp $ */ +/* $NetBSD: common.c,v 1.3 2019/11/16 12:21:06 tkusumi Exp $ */ /*- * Copyright (c) 2017 The NetBSD Foundation, Inc. @@ -36,7 +36,7 @@ * $FreeBSD: head/usr.sbin/autofs/common.c 303527 2016-07-30 01:10:05Z bapt $ */ #include -__RCSID("$NetBSD: common.c,v 1.2 2019/11/16 11:56:29 tkusumi Exp $"); +__RCSID("$NetBSD: common.c,v 1.3 2019/11/16 12:21:06 tkusumi Exp $"); #include #include @@ -357,7 +357,7 @@ expand_ampersand(char *string, const cha * of characters before the '&'. */ before_len = i; - //assert(i + 1 < strlen(string)); + //assert(i < strlen(string)); ret = asprintf(&expanded, "%.*s%s%s", (int)before_len, string, key, string + before_len + 1); @@ -372,6 +372,8 @@ expand_ampersand(char *string, const cha */ string = expanded; i = before_len + strlen(key); + if (i == strlen(string)) + break; backslashed = false; //assert(i < strlen(string)); }
CVS commit: src/usr.sbin/autofs
Module Name:src Committed By: tkusumi Date: Sat Nov 16 12:21:06 UTC 2019 Modified Files: src/usr.sbin/autofs: common.c Log Message: autofs: Fix segfault that could occur on "automount -LL" To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/usr.sbin/autofs/common.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.sbin/autofs
Module Name:src Committed By: tkusumi Date: Sat Nov 16 11:56:29 UTC 2019 Modified Files: src/usr.sbin/autofs: common.c Log Message: autofs: Remove unneeded header include common.c doesn't depend on autofs or its ioctls. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/usr.sbin/autofs/common.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.sbin/autofs
Module Name:src Committed By: tkusumi Date: Sat Nov 16 11:56:29 UTC 2019 Modified Files: src/usr.sbin/autofs: common.c Log Message: autofs: Remove unneeded header include common.c doesn't depend on autofs or its ioctls. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/usr.sbin/autofs/common.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/autofs/common.c diff -u src/usr.sbin/autofs/common.c:1.1 src/usr.sbin/autofs/common.c:1.2 --- src/usr.sbin/autofs/common.c:1.1 Tue Jan 9 03:31:15 2018 +++ src/usr.sbin/autofs/common.c Sat Nov 16 11:56:29 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: common.c,v 1.1 2018/01/09 03:31:15 christos Exp $ */ +/* $NetBSD: common.c,v 1.2 2019/11/16 11:56:29 tkusumi Exp $ */ /*- * Copyright (c) 2017 The NetBSD Foundation, Inc. @@ -36,7 +36,7 @@ * $FreeBSD: head/usr.sbin/autofs/common.c 303527 2016-07-30 01:10:05Z bapt $ */ #include -__RCSID("$NetBSD: common.c,v 1.1 2018/01/09 03:31:15 christos Exp $"); +__RCSID("$NetBSD: common.c,v 1.2 2019/11/16 11:56:29 tkusumi Exp $"); #include #include @@ -50,7 +50,6 @@ __RCSID("$NetBSD: common.c,v 1.1 2018/01 #include #include #include -#include #include "common.h"