Re: write.c patch

2001-12-07 Thread Andrew R. Reiter


-audit might be a more appropriate list for this.

On Fri, 7 Dec 2001, David Hill wrote:

:On Mon, 3 Dec 2001 17:48:43 +
:David Hill <[EMAIL PROTECTED]> wrote:
:
:> This patch was done on -CURRENT.
:> 
:> It is both pasted and attached to this message.
:> 
:> Thanks
:> David
:> 
:> 
:> --- write.c.origMon Dec  3 17:42:45 2001
:> +++ 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);
:>  }
:> 
:
:Will someone please take a look at this patch?  It is for usr.bin/write/write.c
:Thanks
:
:David
:
:
:To Unsubscribe: send mail to [EMAIL PROTECTED]
:with "unsubscribe freebsd-current" in the body of the message
:

--
Andrew R. Reiter
[EMAIL PROTECTED]
[EMAIL PROTECTED]


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: write.c patch

2001-12-07 Thread David Hill

On Mon, 3 Dec 2001 17:48:43 +
David Hill <[EMAIL PROTECTED]> wrote:

> This patch was done on -CURRENT.
> 
> It is both pasted and attached to this message.
> 
> Thanks
> David
> 
> 
> --- write.c.origMon Dec  3 17:42:45 2001
> +++ 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);
>  }
> 

Will someone please take a look at this patch?  It is for usr.bin/write/write.c
Thanks

David


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: write.c patch

2001-12-03 Thread David Hill

On Mon, 3 Dec 2001 17:29:32 -0600
Alfred Perlstein <[EMAIL PROTECTED]> wrote:

> * David Hill <[EMAIL PROTECTED]> [011203 16:50] wrote:
> > This patch was done on -CURRENT.
> > 
> > It is both pasted and attached to this message.
> 
> Which write.c is this to be applied to?
> 
> 
> To Unsubscribe: send mail to [EMAIL PROTECTED]
> with "unsubscribe freebsd-current" in the body of the message

Sorry

$SRC/usr.bin/write/write.c

David

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: write.c patch

2001-12-03 Thread Alfred Perlstein

* David Hill <[EMAIL PROTECTED]> [011203 16:50] wrote:
> This patch was done on -CURRENT.
> 
> It is both pasted and attached to this message.

Which write.c is this to be applied to?


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



write.c patch

2001-12-03 Thread David Hill

This patch was done on -CURRENT.

It is both pasted and attached to this message.

Thanks
David


--- write.c.origMon Dec  3 17:42:45 2001
+++ 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);
 }



write.c.diff
Description: Binary data


Re: write.c patch (WARNS 2)

2001-08-13 Thread David Hill

On Fri, 10 Aug 2001 23:06:49 -0400
David Hill <[EMAIL PROTECTED]> wrote:

> Hello -
>   Here is my patch to make write.c work when WARNS=2. I also did some code 
>cleanup
> 
>   1. Constify
>   2. Changed a strncpy to strlcpy
>   3. Changed (S_IWRITE >> 3) to S_IWGRP
>   4. Cleaned up 2 pieces of code (declaration and unused variable) when WARNS=2 
>is set.
> 
> - David
> 

Could someone please review this patch and comment on it?

Thank you
- David

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



usr.bin/write/write.c patch

2001-07-20 Thread David Hill

Hello -
I patched up write.c a bit.

1. Constified
2. Changed a strncpy to strlcpy
3. change S_IWRITE >> 3 to S_IWGRP
4. Changed fileno(stdin/stdout/stderr) to STD*_FILENO
5. cleaned up 2 pieces of code so it will compile when WARNS=2 is set.

The patch is attached, and can be found at 
http://www.phobia.ms/patches/write.c.20072001.diff
Any comments?

- David Hill

 write.c.20072001.diff