1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-17 07:52:43 +01:00

Include <cstring> to ensure that strcpy(), strlen(), and memset() are declared.

An "using namespace std" was added locally in those functions that refer to
names from <cstring>. That is not pretty, but it's a very portable solution,
because strcpy() and friends will be found in both the 'std' and in the global
namespace.
This commit is contained in:
Peter Simons 2010-06-24 17:51:04 +00:00
parent 560ab22f7d
commit a17071fef1
3 changed files with 6 additions and 0 deletions

View file

@ -13,6 +13,7 @@
#include <iostream>
#include <unistd.h>
#include <cstring>
namespace nix {
@ -158,6 +159,7 @@ void RemoteStore::connectToDaemon()
addr.sun_family = AF_UNIX;
if (socketPathRel.size() >= sizeof(addr.sun_path))
throw Error(format("socket path `%1%' is too long") % socketPathRel);
using namespace std;
strcpy(addr.sun_path, socketPathRel.c_str());
if (connect(fdSocket, (struct sockaddr *) &addr, sizeof(addr)) == -1)