diff options
| author | Devin Teske <dteske@FreeBSD.org> | 2019-12-02 05:24:16 +0000 |
|---|---|---|
| committer | Mateusz Piotrowski <0mp@FreeBSD.org> | 2023-07-06 15:39:23 +0000 |
| commit | 98358de5754cc85b50309323ff72a66193502107 (patch) | |
| tree | d76c73fb9b684971e861c29097c5303975cf2f5b | |
| parent | afbcdd6e080f817ed51af42ac3e645584441abdc (diff) | |
| download | src-98358de5754cc85b50309323ff72a66193502107.tar.gz src-98358de5754cc85b50309323ff72a66193502107.zip | |
Fix spurious error from sysrc
When using sysrc to modify a file, the file should be created silently.
However, with the introduction of SVN r335280, an error of "No such file
or directory" would appear despite everything else working as-expected.
The nature of this spurious error is that SVN r335280 did not check if
the file exists first, before trying to fixup the line-endings in the
file just prior to modification.
PR: bin/240875
Reported by: Jose Luis Duran
MFC after: 3 days
(cherry picked from commit e19a2226fe3bbeeb6e922987475300868374d09a)
| -rw-r--r-- | usr.sbin/bsdconfig/share/sysrc.subr | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/usr.sbin/bsdconfig/share/sysrc.subr b/usr.sbin/bsdconfig/share/sysrc.subr index 010d240f680a..11298f00f47a 100644 --- a/usr.sbin/bsdconfig/share/sysrc.subr +++ b/usr.sbin/bsdconfig/share/sysrc.subr @@ -560,7 +560,7 @@ f_sysrc_set() # if [ "$not_found" ]; then # Add a newline if missing before appending to the file - awk 'BEGIN { wc = 0 } NR == 1 { + [ ! -e "$file" ] || awk 'BEGIN { wc = 0 } NR == 1 { (cmd = "wc -l " FILENAME) | getline close(cmd) wc = $1 |
