summaryrefslogtreecommitdiff
path: root/usr.bin/mg
diff options
context:
space:
mode:
authorTed Unangst <tedu@cvs.openbsd.org>2016-07-28 21:40:26 +0000
committerTed Unangst <tedu@cvs.openbsd.org>2016-07-28 21:40:26 +0000
commitdc5241aa09efdd218c0770267dee0bd0c7eed96e (patch)
tree829b9dd75d32e0a22d1b2ce12f877e5b0c02721e /usr.bin/mg
parent638c6b4a814ddd465000e469c7e8922b30252568 (diff)
strncmp is a more reasonable way to check the beginning of a string.
Diffstat (limited to 'usr.bin/mg')
-rw-r--r--usr.bin/mg/fileio.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/usr.bin/mg/fileio.c b/usr.bin/mg/fileio.c
index 667ad69d867..1888fd039ca 100644
--- a/usr.bin/mg/fileio.c
+++ b/usr.bin/mg/fileio.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fileio.c,v 1.102 2016/07/28 21:37:45 tedu Exp $ */
+/* $OpenBSD: fileio.c,v 1.103 2016/07/28 21:40:25 tedu Exp $ */
/* This file is in the public domain. */
@@ -681,13 +681,10 @@ toggleleavetmp(int f, int n)
int
bkupleavetmp(const char *fn)
{
- char *tmp = NULL;
-
if (!leavetmp)
return(FALSE);
- tmp = strstr(fn, "/tmp");
- if (tmp == fn)
+ if (strncmp(fn, "/tmp", 4) == 0)
return (TRUE);
return (FALSE);