diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2010-08-24 13:54:04 +0300 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2010-08-24 13:54:04 +0300 |
commit | 692945f29e2f99baac2378adb542bf131d2ce4f7 (patch) | |
tree | 5e15dac3df553347f41620b0804dc76ba3e8c016 /build/pack.c | |
parent | 64a1351844d527f7c9a43afaefc373c2d07b7152 (diff) | |
download | rpm-692945f29e2f99baac2378adb542bf131d2ce4f7.tar.gz rpm-692945f29e2f99baac2378adb542bf131d2ce4f7.tar.bz2 rpm-692945f29e2f99baac2378adb542bf131d2ce4f7.zip |
Eliminate buildHost() and getBuildTime() from librpmbuild API
- Neither is needed anywhere outside pack.c, bury there and make static
Diffstat (limited to 'build/pack.c')
-rw-r--r-- | build/pack.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/build/pack.c b/build/pack.c index a4fcddf38..26d31fbcf 100644 --- a/build/pack.c +++ b/build/pack.c @@ -6,6 +6,8 @@ #include "system.h" #include <errno.h> +#include <netdb.h> +#include <time.h> #include <rpm/rpmlib.h> /* RPMSIGTAG*, rpmReadPackageFile */ #include <rpm/rpmts.h> @@ -147,6 +149,33 @@ exit: return sb; } +static rpm_time_t * getBuildTime(void) +{ + static rpm_time_t buildTime[1]; + + if (buildTime[0] == 0) + buildTime[0] = (int32_t) time(NULL); + return buildTime; +} + +static const char * buildHost(void) +{ + static char hostname[1024]; + static int oneshot = 0; + struct hostent *hbn; + + if (! oneshot) { + (void) gethostname(hostname, sizeof(hostname)); + hbn = gethostbyname(hostname); + if (hbn) + strcpy(hostname, hbn->h_name); + else + rpmlog(RPMLOG_WARNING, + _("Could not canonicalize hostname: %s\n"), hostname); + oneshot = 1; + } + return(hostname); +} /** */ static int addFileToTag(rpmSpec spec, const char * file, Header h, rpmTag tag) |