FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > ArchLinux > ArchLinux Pacman Development

 
 
LinkBack Thread Tools
 
Old 03-28-2011, 07:15 PM
Dave Reisner
 
Default pacman: use alpm method to set useragent

The call for this needs to be done a little later now since it requires
that the handle be initialized.

Signed-off-by: Dave Reisner <d@falconindy.com>
---
src/pacman/pacman.c | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c
index eac9c9c..381d2bc 100644
--- a/src/pacman/pacman.c
+++ b/src/pacman/pacman.c
@@ -253,13 +253,13 @@ static void localize(void)
*/
static void setuseragent(void)
{
- char agent[101];
+ char *agent;
struct utsname un;

uname(&un);
- snprintf(agent, 100, "pacman/%s (%s %s) libalpm/%s",
+ pm_asprintf(&agent, "pacman/%s (%s %s) libalpm/%s",
PACKAGE_VERSION, un.sysname, un.machine, alpm_version());
- setenv("HTTP_USER_AGENT", agent, 0);
+ alpm_option_set_useragent(agent);
}

static void setarch(const char *arch)
@@ -1360,9 +1360,6 @@ int main(int argc, char *argv[])
localize();
#endif

- /* set user agent for downloading */
- setuseragent();
-
/* init config data */
config = config_new();

@@ -1387,6 +1384,9 @@ int main(int argc, char *argv[])
alpm_option_set_signaturedir(GPGDIR);
alpm_option_set_logfile(LOGFILE);

+ /* set user agent for downloading */
+ setuseragent();
+
/* Priority of options:
* 1. command line
* 2. config file
--
1.7.4.2
 

Thread Tools




All times are GMT. The time now is 02:37 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org