summaryrefslogtreecommitdiffstats
path: root/contrib/sendmail/test/t_exclopen.c
diff options
context:
space:
mode:
authorgshapiro <gshapiro@FreeBSD.org>2000-08-12 21:55:49 +0000
committergshapiro <gshapiro@FreeBSD.org>2000-08-12 21:55:49 +0000
commit4332139a9a11f773ffe5109bed871561e3c290a1 (patch)
tree6d207932926718f38869bd08959330c09f4f3e0d /contrib/sendmail/test/t_exclopen.c
parenta392fe0bdb7081117c445f5dcc98d5ed4013dc17 (diff)
downloadFreeBSD-src-4332139a9a11f773ffe5109bed871561e3c290a1.zip
FreeBSD-src-4332139a9a11f773ffe5109bed871561e3c290a1.tar.gz
Import of sendmail version 8.11.0 into vendor branch SENDMAIL with
release tag v8_11_0. Obtained from: ftp://ftp.sendmail.org/pub/sendmail/
Diffstat (limited to 'contrib/sendmail/test/t_exclopen.c')
-rw-r--r--contrib/sendmail/test/t_exclopen.c38
1 files changed, 24 insertions, 14 deletions
diff --git a/contrib/sendmail/test/t_exclopen.c b/contrib/sendmail/test/t_exclopen.c
index a42baa9..22ef693 100644
--- a/contrib/sendmail/test/t_exclopen.c
+++ b/contrib/sendmail/test/t_exclopen.c
@@ -28,15 +28,30 @@
** Ultrix 4.3 OK
*/
-#include <stdio.h>
-#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
+#include <errno.h>
#include <fcntl.h>
+#include <stdio.h>
+#include <unistd.h>
-char Attacker[128];
-char Attackee[128];
+#ifndef lint
+static char id[] = "@(#)$Id: t_exclopen.c,v 8.5 1999/08/28 00:25:28 gshapiro Exp $";
+#endif /* ! lint */
+
+static char Attacker[128];
+static char Attackee[128];
+
+static void
+bail(status)
+ int status;
+{
+ (void) unlink(Attacker);
+ (void) unlink(Attackee);
+ exit(status);
+}
+int
main(argc, argv)
int argc;
char **argv;
@@ -61,16 +76,16 @@ main(argc, argv)
}
if (open(Attacker, O_WRONLY|O_CREAT|O_EXCL, 0644) < 0)
{
- int saveerr = errno;
+ int save_errno = errno;
if (stat(Attackee, &st) >= 0)
{
printf("Weird. Open failed but %s was created anyhow (errno = %d)\n",
- Attackee, saveerr);
+ Attackee, save_errno);
bail(1);
}
printf("Good show! Exclusive open works properly with symbolic links (errno = %d).\n",
- saveerr);
+ save_errno);
bail(0);
}
if (stat(Attackee, &st) < 0)
@@ -82,12 +97,7 @@ main(argc, argv)
printf("Bad news: you can do an exclusive open through a symbolic link\n");
printf("\tBe sure you #define BOGUS_O_EXCL in conf.h\n");
bail(1);
-}
-bail(stat)
- int stat;
-{
- (void) unlink(Attacker);
- (void) unlink(Attackee);
- exit(stat);
+ /* NOTREACHED */
+ exit(0);
}
OpenPOWER on IntegriCloud