Step3, pam_opie snprintf bloat fix for review

2002-01-20 Thread Andrey A. Chernov

Bug:
snprintf is large and slow, increasing program size and slowing it down.
Better way is avoid snprintf when it is not neccessary.

Fix:
Full functionality of snprintf is not needed below, so it is replaced by 
much faster strlcpy.

--- pam_opie.c.bak  Sat Jan 19 21:29:49 2002
+++ pam_opie.c  Sun Jan 20 22:23:18 2002
@@ -125,7 +125,7 @@
}
 
/* We have to copy the response, because opieverify mucks with it. */
-   snprintf(resp, sizeof resp, %s, response);
+   strlcpy(resp, response, sizeof resp);
 
/*
 * Opieverify is supposed to return -1 only if an error occurs.
-- 
Andrey A. Chernov
http://ache.pp.ru/

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



Re: Step3, pam_opie snprintf bloat fix for review

2002-01-20 Thread Dag-Erling Smorgrav

Andrey A. Chernov [EMAIL PROTECTED] writes:
 Bug:
 snprintf is large and slow, increasing program size and slowing it down.
 Better way is avoid snprintf when it is not neccessary.
 
 Fix:
 Full functionality of snprintf is not needed below, so it is replaced by 
 much faster strlcpy.

Approved (unless Mark has any objections).

DES
-- 
Dag-Erling Smorgrav - [EMAIL PROTECTED]

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



Re: Step3, pam_opie snprintf bloat fix for review

2002-01-20 Thread Mark Murray

 Bug:
 snprintf is large and slow, increasing program size and slowing it down.
 Better way is avoid snprintf when it is not neccessary.
 
 Fix:
 Full functionality of snprintf is not needed below, so it is replaced by 
 much faster strlcpy.

This is fine!

Style - please make it 'sizeof(foo)', not 'sizeof foo'.

M

 --- pam_opie.c.bakSat Jan 19 21:29:49 2002
 +++ pam_opie.cSun Jan 20 22:23:18 2002
 @@ -125,7 +125,7 @@
   }
  
   /* We have to copy the response, because opieverify mucks with it. */
 - snprintf(resp, sizeof resp, %s, response);
 + strlcpy(resp, response, sizeof resp);
  
   /*
* Opieverify is supposed to return -1 only if an error occurs.
 -- 
 Andrey A. Chernov
 http://ache.pp.ru/
 
 To Unsubscribe: send mail to [EMAIL PROTECTED]
 with unsubscribe freebsd-current in the body of the message
-- 
o   Mark Murray
\_  FreeBSD Services Limited
O.\_Warning: this .sig is umop ap!sdn

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