PERFORCE change 199874 for review
Pawel Jakub Dawidek
pjd at FreeBSD.org
Fri Oct 7 22:16:26 UTC 2011
http://p4web.freebsd.org/@@199874?ac=10
Change 199874 by pjd at pjd_anger on 2011/10/07 22:15:34
Simplify code by using strdup().
Affected files ...
.. //depot/projects/trustedbsd/openbsm/bin/auditd/auditd.c#48 edit
Differences ...
==== //depot/projects/trustedbsd/openbsm/bin/auditd/auditd.c#48 (text+ko) ====
@@ -26,7 +26,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $P4: //depot/projects/trustedbsd/openbsm/bin/auditd/auditd.c#47 $
+ * $P4: //depot/projects/trustedbsd/openbsm/bin/auditd/auditd.c#48 $
*/
#include <sys/types.h>
@@ -155,18 +155,15 @@
{
char *ptr;
char *oldname;
- size_t len;
/* If lastfile is NULL try to get it from the 'current' link. */
if (lastfile == NULL)
lastfile = get_curfile();
if (lastfile != NULL) {
- len = strlen(lastfile) + 1;
- oldname = (char *)malloc(len);
+ oldname = strdup(lastfile);
if (oldname == NULL)
return (-1);
- strlcpy(oldname, lastfile, len);
/* Rename the last file -- append timestamp. */
if ((ptr = strstr(lastfile, NOT_TERMINATED)) != NULL) {
More information about the p4-projects
mailing list