~ubuntu-branches/ubuntu/utopic/pacemaker/utopic-proposed

« back to all changes in this revision

Viewing changes to replace/unsetenv.c

  • Committer: Package Import Robot
  • Author(s): Andres Rodriguez
  • Date: 2013-07-16 16:40:24 UTC
  • mfrom: (1.1.11) (2.2.3 experimental)
  • Revision ID: package-import@ubuntu.com-20130716164024-lvwrf4xivk1wdr3c
Tags: 1.1.9+git20130321-1ubuntu1
* Resync from debian expiremental.
* debian/control:
  - Use lower version for Build-Depends on libcorosync-dev
    and libqb-dev.
  - Build-Depends on libcfg-dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
#endif
32
32
 
33
33
int
34
 
unsetenv (const char *name)
 
34
unsetenv(const char *name)
35
35
{
36
 
        const size_t len = strlen (name);
37
 
        char **ep;
38
 
 
39
 
        for (ep = __environ; *ep; ++ep) {
40
 
                if (!strncmp (*ep, name, len) && (*ep)[len] == '=') {
41
 
                        /* Found it.  */
42
 
                        /* Remove this pointer by moving later ones back.  */
43
 
                        char **dp = ep;
44
 
                        do
45
 
                                dp[0] = dp[1];
46
 
                        while (*dp++);
47
 
                        /* Continue the loop in case NAME appears again.  */  
48
 
                }
49
 
        }
50
 
        return 0;
 
36
    const size_t len = strlen(name);
 
37
    char **ep;
 
38
 
 
39
    for (ep = __environ; *ep; ++ep) {
 
40
        if (!strncmp(*ep, name, len) && (*ep)[len] == '=') {
 
41
            /* Found it.  */
 
42
            /* Remove this pointer by moving later ones back.  */
 
43
            char **dp = ep;
 
44
 
 
45
            do
 
46
                dp[0] = dp[1];
 
47
            while (*dp++);
 
48
            /* Continue the loop in case NAME appears again.  */
 
49
        }
 
50
    }
 
51
    return 0;
51
52
}