Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 8 Dec 2001 10:15:21 +0000
From:      David Hill <lists@phobia.ms>
To:        freebsd-audit@freebsd.org
Subject:   write.c diff
Message-ID:  <20011208101521.0163ee8c.lists@phobia.ms>

next in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.

--Multipart_Sat__8_Dec_2001_10:15:21_+0000_08168000
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit

Hello -
Here is a small code cleanup patch for write(1).

- David

--- /usr/src/usr.bin/write/write.c.orig Mon Dec  3 17:42:45 2001
+++ /usr/src/usr.bin/write/write.c      Mon Dec  3 17:45:22 2001
@@ -190,8 +190,7 @@
        while (read(ufd, (char *) &u, sizeof(u)) == sizeof(u))
                if (strncmp(user, u.ut_name, sizeof(u.ut_name)) == 0) {
                        ++nloggedttys;
-                       (void)strncpy(atty, u.ut_line, UT_LINESIZE);
-                       atty[UT_LINESIZE] = '\0';
+                       (void)strlcpy(atty, u.ut_line, UT_LINESIZE);
                        if (term_chk(atty, &msgsok, &atime, 0))
                                continue;       /* bad term? skip */
                        if (myuid && !msgsok)
@@ -240,7 +239,7 @@
                        warn("%s", path);
                return(1);
        }
-       *msgsokP = (s.st_mode & (S_IWRITE >> 3)) != 0;  /* group write bit */
+       *msgsokP = (s.st_mode & S_IWGRP) != 0;  /* group write bit */
        *atimeP = s.st_atime;
        return(0);
 }

--Multipart_Sat__8_Dec_2001_10:15:21_+0000_08168000
Content-Type: application/octet-stream;
 name="write.c.diff"
Content-Disposition: attachment;
 filename="write.c.diff"
Content-Transfer-Encoding: base64

LS0tIC91c3Ivc3JjL3Vzci5iaW4vd3JpdGUvd3JpdGUuYy5vcmlnCU1vbiBEZWMgIDMgMTc6NDI6
NDUgMjAwMQorKysgL3Vzci9zcmMvdXNyLmJpbi93cml0ZS93cml0ZS5jCU1vbiBEZWMgIDMgMTc6
NDU6MjIgMjAwMQpAQCAtMTkwLDggKzE5MCw3IEBACiAJd2hpbGUgKHJlYWQodWZkLCAoY2hhciAq
KSAmdSwgc2l6ZW9mKHUpKSA9PSBzaXplb2YodSkpCiAJCWlmIChzdHJuY21wKHVzZXIsIHUudXRf
bmFtZSwgc2l6ZW9mKHUudXRfbmFtZSkpID09IDApIHsKIAkJCSsrbmxvZ2dlZHR0eXM7Ci0JCQko
dm9pZClzdHJuY3B5KGF0dHksIHUudXRfbGluZSwgVVRfTElORVNJWkUpOwotCQkJYXR0eVtVVF9M
SU5FU0laRV0gPSAnXDAnOworCQkJKHZvaWQpc3RybGNweShhdHR5LCB1LnV0X2xpbmUsIFVUX0xJ
TkVTSVpFKTsKIAkJCWlmICh0ZXJtX2NoayhhdHR5LCAmbXNnc29rLCAmYXRpbWUsIDApKQogCQkJ
CWNvbnRpbnVlOwkvKiBiYWQgdGVybT8gc2tpcCAqLwogCQkJaWYgKG15dWlkICYmICFtc2dzb2sp
CkBAIC0yNDAsNyArMjM5LDcgQEAKIAkJCXdhcm4oIiVzIiwgcGF0aCk7CiAJCXJldHVybigxKTsK
IAl9Ci0JKm1zZ3Nva1AgPSAocy5zdF9tb2RlICYgKFNfSVdSSVRFID4+IDMpKSAhPSAwOwkvKiBn
cm91cCB3cml0ZSBiaXQgKi8KKwkqbXNnc29rUCA9IChzLnN0X21vZGUgJiBTX0lXR1JQKSAhPSAw
OwkvKiBncm91cCB3cml0ZSBiaXQgKi8KIAkqYXRpbWVQID0gcy5zdF9hdGltZTsKIAlyZXR1cm4o
MCk7CiB9Cg==

--Multipart_Sat__8_Dec_2001_10:15:21_+0000_08168000--

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?20011208101521.0163ee8c.lists>