X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Farlib.c;h=43a9145b71a6a0a9c7ff691313e81bcc496d72f8;hb=a286dd013ef8d46edf013efc0908822a59d8ac81;hp=bcf9344bd4fb25fd6a6481c9b3e8b369a3ca1e7a;hpb=6dc551eec9ecf4cfc52e5e43ee8e3624e1249b93;p=platform%2Fupstream%2Felfutils.git diff --git a/src/arlib.c b/src/arlib.c index bcf9344..43a9145 100644 --- a/src/arlib.c +++ b/src/arlib.c @@ -1,27 +1,20 @@ /* Functions to handle creation of Linux archives. Copyright (C) 2007-2012 Red Hat, Inc. + This file is part of elfutils. Written by Ulrich Drepper , 2007. - Red Hat elfutils is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by the - Free Software Foundation; version 2 of the License. + This file is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. - Red Hat elfutils is distributed in the hope that it will be useful, but + elfutils is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. - You should have received a copy of the GNU General Public License along - with Red Hat elfutils; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. - - Red Hat elfutils is an included package of the Open Invention Network. - An included package of the Open Invention Network is a package for which - Open Invention Network licensees cross-license their patents. No patent - license is granted, either expressly or impliedly, by designation as an - included package. Should you wish to participate in the Open Invention - Network licensing program, please visit www.openinventionnetwork.com - . */ + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #ifdef HAVE_CONFIG_H # include @@ -66,11 +59,11 @@ arlib_init (void) _FORTIFY_SOURCE=2 would not let us play these games. Therefore we play it safe. */ char tmpbuf[sizeof (ar_hdr.ar_date) + 1]; - memcpy (ar_hdr.ar_date, tmpbuf, - snprintf (tmpbuf, sizeof (tmpbuf), "%-*lld", + int s = snprintf (tmpbuf, sizeof (tmpbuf), "%-*lld", (int) sizeof (ar_hdr.ar_date), (arlib_deterministic_output ? 0 - : (long long int) time (NULL)))); + : (long long int) time (NULL))); + memcpy (ar_hdr.ar_date, tmpbuf, s); assert ((sizeof (struct ar_hdr) % sizeof (uint32_t)) == 0); /* Note the string for the ar_uid and ar_gid cases is longer than @@ -128,10 +121,10 @@ arlib_finalize (void) symtab.longnames = obstack_finish (&symtab.longnamesob); - memcpy (&((struct ar_hdr *) symtab.longnames)->ar_size, tmpbuf, - snprintf (tmpbuf, sizeof (tmpbuf), "%-*zu", + int s = snprintf (tmpbuf, sizeof (tmpbuf), "%-*zu", (int) sizeof (((struct ar_hdr *) NULL)->ar_size), - symtab.longnameslen - sizeof (struct ar_hdr))); + symtab.longnameslen - sizeof (struct ar_hdr)); + memcpy (&((struct ar_hdr *) symtab.longnames)->ar_size, tmpbuf, s); } symtab.symsofflen = obstack_object_size (&symtab.symsoffob);