mailing list of musl libc
 help / color / mirror / code / Atom feed
86873cd00d441f2827d8f3d6e1cc03dfb1e7518b blob 552 bytes (raw)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
 
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include "libc.h"

char *__strchrnul(const char *, int);

static void dummy(char *p, char *r) {}
weak_alias(dummy, __env_change);

int unsetenv(const char *name)
{
	size_t l = __strchrnul(name, '=') - name;
	if (!l || name[l]) {
		errno = EINVAL;
		return -1;
	}
	if (!__environ) return 0;
	for (char **e = __environ; *e; e++)
		while (*e && !strncmp(name, *e, l) && l[*e] == '=') {
			char **ee = e, *tmp = *e;
			do *ee = *(ee+1);
			while (*++ee);
			__env_change(tmp, 0);
		}
	return 0;
}
debug log:

solving 86873cd ...
found 86873cd in https://inbox.vuxu.org/musl/1457895230-13602-2-git-send-email-amonakov@ispras.ru/
found 3569335 in https://git.vuxu.org/mirror/musl/
preparing index
index prepared:
100644 356933546a31a41ad859c3bc08709aa76a5a2644	src/env/unsetenv.c

applying [1/1] https://inbox.vuxu.org/musl/1457895230-13602-2-git-send-email-amonakov@ispras.ru/
diff --git a/src/env/unsetenv.c b/src/env/unsetenv.c
dissimilarity index 77%
index 3569335..86873cd 100644

Checking patch src/env/unsetenv.c...
Applied patch src/env/unsetenv.c cleanly.

index at:
100644 86873cd00d441f2827d8f3d6e1cc03dfb1e7518b	src/env/unsetenv.c

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).