mirror of
https://github.com/slicer69/doas
synced 2024-09-28 20:23:31 +00:00
Make sure doasedit can work when target file to edit has a leading slash
character. ie A full path name is used. Update doas.1 manual page to indicate problems with piping input on Linux when processes are launched by doas.
This commit is contained in:
parent
7c3981ce28
commit
23818b138e
5
doas.1
5
doas.1
|
@ -110,6 +110,11 @@ The password was incorrect.
|
|||
.It
|
||||
The specified command was not found or is not executable.
|
||||
.El
|
||||
.Sh BUGS
|
||||
On Linux it is not possible to pipe output from other commands into commands run by doas.
|
||||
For example, "echo hello | doas tee abc" would not work on Linux.
|
||||
On other platforms, such as FreeBSD, output from another command can be piped to programs
|
||||
run by doas.
|
||||
.Sh SEE ALSO
|
||||
.Xr su 1 ,
|
||||
.Xr doas.conf 5
|
||||
|
|
13
doasedit
13
doasedit
|
@ -38,7 +38,8 @@ then
|
|||
fi
|
||||
|
||||
mydir=$(dirname -- "$1")
|
||||
cp "$mydir/$1" "$temp_file"
|
||||
myfile=$(basename -- "$1")
|
||||
cp "$mydir/$myfile" "$temp_file"
|
||||
status=$?
|
||||
if [ $status -ne 0 ]
|
||||
then
|
||||
|
@ -66,7 +67,7 @@ then
|
|||
fi
|
||||
|
||||
# Check to see if the file has been changed.
|
||||
cmp -s "$mydir/$1" "$temp_file"
|
||||
cmp -s "$mydir/$myfile" "$temp_file"
|
||||
status=$?
|
||||
if [ $status -eq 0 ]
|
||||
then
|
||||
|
@ -78,16 +79,16 @@ fi
|
|||
# At this point the file has been changed. Make sure it still exists.
|
||||
if [ -f "$temp_file" ]
|
||||
then
|
||||
doas cp "$temp_file" "$mydir/$1"
|
||||
cmp -s "$temp_file" "$mydir/$1"
|
||||
doas cp "$temp_file" "$mydir/$myfile"
|
||||
cmp -s "$temp_file" "$mydir/$myfile"
|
||||
status=$?
|
||||
# If file fails to copy, do not do clean-up
|
||||
while [ $status -ne 0 ]
|
||||
do
|
||||
echo "Copying file back to $1 failed. Press Ctrl-C to abort or Enter to try again."
|
||||
read abc
|
||||
doas cp "$temp_file" "$mydir/$1"
|
||||
cmp -s "$temp_file" "$mydir/$1"
|
||||
doas cp "$temp_file" "$mydir/$myfile"
|
||||
cmp -s "$temp_file" "$mydir/$myfile"
|
||||
status=$?
|
||||
done
|
||||
fi
|
||||
|
|
Loading…
Reference in a new issue