summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2015-11-09 02:59:07 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2015-11-09 02:59:07 +0000
commitd5518d3ecbf33825b14179efcc55c8eff0739f1f (patch)
treecbb66cafa89f7d9c3a8b5935e9447bf4f36dae46
parent03e26435adecc5b117f0f1014d23f010768992dd (diff)
do not need wrappers around O_RDONLY and such
-rw-r--r--usr.bin/less/decode.c2
-rw-r--r--usr.bin/less/edit.c4
-rw-r--r--usr.bin/less/less.h6
-rw-r--r--usr.bin/less/lsystem.c2
-rw-r--r--usr.bin/less/ttyin.c2
5 files changed, 5 insertions, 11 deletions
diff --git a/usr.bin/less/decode.c b/usr.bin/less/decode.c
index 66b116e7469..85db7eadcff 100644
--- a/usr.bin/less/decode.c
+++ b/usr.bin/less/decode.c
@@ -623,7 +623,7 @@ lesskey(char *filename, int sysvar)
* Try to open the lesskey file.
*/
filename = shell_unquote(filename);
- f = open(filename, OPEN_READ);
+ f = open(filename, O_RDONLY);
free(filename);
if (f < 0)
return (1);
diff --git a/usr.bin/less/edit.c b/usr.bin/less/edit.c
index 2f2c507f851..e257fba39bf 100644
--- a/usr.bin/less/edit.c
+++ b/usr.bin/less/edit.c
@@ -651,7 +651,7 @@ use_logfile(char *filename)
* {{ We could use access() here. }}
*/
filename = shell_unquote(filename);
- exists = open(filename, OPEN_READ);
+ exists = open(filename, O_RDONLY);
close(exists);
exists = (exists >= 0);
@@ -685,7 +685,7 @@ loop:
/*
* Append: open the file and seek to the end.
*/
- logfile = open(filename, OPEN_APPEND);
+ logfile = open(filename, O_WRONLY | O_APPEND);
if (lseek(logfile, (off_t)0, SEEK_END) == BAD_LSEEK) {
close(logfile);
logfile = -1;
diff --git a/usr.bin/less/less.h b/usr.bin/less/less.h
index 7af71c98117..949ba138fcf 100644
--- a/usr.bin/less/less.h
+++ b/usr.bin/less/less.h
@@ -87,12 +87,6 @@ typedef off_t LINENUM;
#define MIN_LINENUM_WIDTH 7 /* Min printing width of a line number */
#define MAX_UTF_CHAR_LEN 6 /* Max bytes in one UTF-8 char */
-/*
- * Flags for open()
- */
-#define OPEN_READ (O_RDONLY)
-#define OPEN_APPEND (O_APPEND|O_WRONLY)
-
#define SHELL_META_QUEST 1
#define SPACES_IN_FILENAMES 1
diff --git a/usr.bin/less/lsystem.c b/usr.bin/less/lsystem.c
index 6e19fb7eee1..19ff2aeaf4e 100644
--- a/usr.bin/less/lsystem.c
+++ b/usr.bin/less/lsystem.c
@@ -73,7 +73,7 @@ lsystem(const char *cmd, const char *donemsg)
*/
inp = dup(0);
(void) close(0);
- if (open("/dev/tty", OPEN_READ) < 0)
+ if (open("/dev/tty", O_RDONLY) < 0)
(void) dup(inp);
/*
diff --git a/usr.bin/less/ttyin.c b/usr.bin/less/ttyin.c
index a234e18188d..84eadcb324d 100644
--- a/usr.bin/less/ttyin.c
+++ b/usr.bin/less/ttyin.c
@@ -31,7 +31,7 @@ open_getchr(void)
* which in Unix is usually attached to the screen,
* but also usually lets you read from the keyboard.
*/
- tty = open("/dev/tty", OPEN_READ);
+ tty = open("/dev/tty", O_RDONLY);
if (tty < 0)
tty = 2;
}