Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 18 Aug 2001 23:58:33 -0700
From:      Kris Kennaway <kris@obsecurity.org>
To:        ig25@rz.uni-karlsruhe.de, audit@FreeBSD.org
Subject:   at(1) signal handler fix
Message-ID:  <20010818235833.A36306@xor.obsecurity.org>

next in thread | raw e-mail | index | archive | help

--MGYHOYXEY6WxJCY8
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

This patch is adapted from OpenBSD..please review.

Kris

Index: at.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /mnt/ncvs/src/usr.bin/at/at.c,v
retrieving revision 1.19
diff -u -r1.19 at.c
--- at.c	2001/07/24 14:15:51	1.19
+++ at.c	2001/08/19 06:58:02
@@ -113,6 +113,7 @@
 char *atinput =3D (char*)0;	/* where to get input from */
 char atqueue =3D 0;		/* which queue to examine for jobs (atq) */
 char atverify =3D 0;		/* verify time instead of queuing job */
+char *namep;
=20
 /* Function declarations */
=20
@@ -135,14 +136,23 @@
 	PRIV_END
     }
=20
-    exit(EXIT_FAILURE);
+    _exit(EXIT_FAILURE);
 }
=20
 static void alarmc(int signo)
 {
-/* Time out after some seconds
- */
-    panic("file locking timed out");
+    char buf[1024];
+
+    /* Time out after some seconds. */
+    strlcpy(buf, namep, sizeof(buf));
+    strlcat(buf, ": file locking timed out\n", sizeof(buf));
+    write(STDERR_FILENO, buf, strlen(buf));
+    if (fcreated) {
+        PRIV_START
+	    unlink(atfile);
+        PRIV_END
+    }
+    _exit(EXIT_FAILURE);
 }
=20
 /* Local functions */
@@ -611,6 +621,8 @@
     else
         pgm++;
=20
+    namep =3D pgm;
+
     /* find out what this program is supposed to do
      */
     if (strcmp(pgm, "atq") =3D=3D 0) {
@@ -695,8 +707,9 @@
      */
=20
     if (disp_version)
-	fprintf(stderr, "at version " VERSION "\n"
-			"Bug reports to: ig25@rz.uni-karlsruhe.de (Thomas Koenig)\n");
+	fprintf(stderr, "%s version " VERSION "\n"
+	    "Bug reports to: ig25@rz.uni-karlsruhe.de (Thomas Koenig)\n",
+	    namep);
=20
     /* select our program
      */

--MGYHOYXEY6WxJCY8
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (FreeBSD)
Comment: For info see http://www.gnupg.org

iD8DBQE7f2OZWry0BWjoQKURAlwPAJoCo1uY+8VNKKhZxkomCzQznGnVCQCfciiX
XJWTEXPe4O617GpellZXheM=
=q8Xs
-----END PGP SIGNATURE-----

--MGYHOYXEY6WxJCY8--

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-audit" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010818235833.A36306>