[PATCH v2 3/4] wrapper: supply xsetenv and xputenv

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Erik Faye-Lund <kusmabite@xxxxxxxxx>
---
 git-compat-util.h |    2 ++
 wrapper.c         |   14 ++++++++++++++
 2 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/git-compat-util.h b/git-compat-util.h
index 77062ed..ab17d53 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -439,6 +439,8 @@ extern int xdup(int fd);
 extern FILE *xfdopen(int fd, const char *mode);
 extern int xmkstemp(char *template);
 extern int xmkstemp_mode(char *template, int mode);
+extern int xsetenv(const char *name, const char *val, int override);
+extern int xputenv(const char *string);
 extern int odb_mkstemp(char *template, size_t limit, const char *pattern);
 extern int odb_pack_keep(char *name, size_t namesz, unsigned char *sha1);
 
diff --git a/wrapper.c b/wrapper.c
index 85f09df..8d172ac 100644
--- a/wrapper.c
+++ b/wrapper.c
@@ -381,3 +381,17 @@ int remove_or_warn(unsigned int mode, const char *file)
 {
 	return S_ISGITLINK(mode) ? rmdir_or_warn(file) : unlink_or_warn(file);
 }
+
+int xsetenv(const char *name, const char *val, int overwrite)
+{
+	if (setenv(name, val, overwrite))
+		die_errno("setenv failed to set '%s' to '%s'", name, val);
+	return 0;
+}
+
+int xputenv(const char *string)
+{
+	if (putenv(string))
+		die_errno("putenv failed to set '%s' ", string);
+	return 0;
+}
-- 
1.7.7.1.msysgit.0.272.g9e47e

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]