summaryrefslogtreecommitdiff
path: root/apt-pkg/contrib/netrc.cc
diff options
context:
space:
mode:
Diffstat (limited to 'apt-pkg/contrib/netrc.cc')
-rw-r--r--apt-pkg/contrib/netrc.cc7
1 files changed, 5 insertions, 2 deletions
diff --git a/apt-pkg/contrib/netrc.cc b/apt-pkg/contrib/netrc.cc
index 9ff5796c5..56e59d84b 100644
--- a/apt-pkg/contrib/netrc.cc
+++ b/apt-pkg/contrib/netrc.cc
@@ -11,9 +11,12 @@
##################################################################### */
/*}}}*/
+#include <config.h>
#include <apt-pkg/configuration.h>
+#include <apt-pkg/strutl.h>
#include <apt-pkg/fileutl.h>
+
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
@@ -23,6 +26,7 @@
#include "netrc.h"
+using std::string;
/* Get user and password from .netrc when given a machine name */
@@ -64,8 +68,7 @@ int parsenetrc (char *host, char *login, char *password, char *netrcfile = NULL)
if (!home)
return -1;
- asprintf (&netrcfile, "%s%s%s", home, DIR_CHAR, NETRC);
- if(!netrcfile)
+ if (asprintf (&netrcfile, "%s%s%s", home, DIR_CHAR, NETRC) == -1 || netrcfile == NULL)
return -1;
else
netrc_alloc = true;