Skip to content

Commit

Permalink
Fix spurious error from sysrc
Browse files Browse the repository at this point in the history
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
  • Loading branch information
devinteske committed Dec 2, 2019
1 parent 772b3a8 commit e19a222
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion usr.sbin/bsdconfig/share/sysrc.subr
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e19a222

Please sign in to comment.