summaryrefslogtreecommitdiff
path: root/scp.c
diff options
context:
space:
mode:
authorderaadt@openbsd.org <deraadt@openbsd.org>2021-10-24 21:24:17 +0000
committerDamien Miller <djm@mindrot.org>2021-10-28 13:56:59 +1100
commitd4bed5445646e605c383a4374fa962e23bf9e3a3 (patch)
treeadfeeee668d57fc44127dc503c956f376e03cec6 /scp.c
parentd575cf44895104e0fcb0629920fb645207218129 (diff)
downloadopenssh-git-d4bed5445646e605c383a4374fa962e23bf9e3a3.tar.gz
upstream: For open/openat, if the flags parameter does not contain
O_CREAT, the 3rd (variadic) mode_t parameter is irrelevant. Many developers in the past have passed mode_t (0, 044, 0644, or such), which might lead future people to copy this broken idiom, and perhaps even believe this parameter has some meaning or implication or application. Delete them all. This comes out of a conversation where tb@ noticed that a strange (but intentional) pledge behaviour is to always knock-out high-bits from mode_t on a number of system calls as a safety factor, and his bewilderment that this appeared to be happening against valid modes (at least visually), but no sorry, they are all irrelevant junk. They could all be 0xdeafbeef. ok millert OpenBSD-Commit-ID: 503d11633497115688c0c6952686524f01f53121
Diffstat (limited to 'scp.c')
-rw-r--r--scp.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/scp.c b/scp.c
index a5598f39..7145d1a8 100644
--- a/scp.c
+++ b/scp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: scp.c,v 1.240 2021/10/15 14:46:46 deraadt Exp $ */
+/* $OpenBSD: scp.c,v 1.241 2021/10/24 21:24:17 deraadt Exp $ */
/*
* scp - secure remote copy. This is basically patched BSD rcp which
* uses ssh to do the data transfer (instead of using rcmd).
@@ -1327,7 +1327,7 @@ source(int argc, char **argv)
len = strlen(name);
while (len > 1 && name[len-1] == '/')
name[--len] = '\0';
- if ((fd = open(name, O_RDONLY|O_NONBLOCK, 0)) == -1)
+ if ((fd = open(name, O_RDONLY|O_NONBLOCK)) == -1)
goto syserr;
if (strchr(name, '\n') != NULL) {
strnvis(encname, name, sizeof(encname), VIS_NL);