View | Details | Raw Unified | Return to bug 39886
Collapse All | Expand All

(-)include/arch/win32/apr_arch_inherit.h (+28 lines)
Lines 21-29 Link Here
21
21
22
#define APR_INHERIT (1 << 24)    /* Must not conflict with other bits */
22
#define APR_INHERIT (1 << 24)    /* Must not conflict with other bits */
23
23
24
#if defined(_WIN32_WCE)
24
#define APR_IMPLEMENT_INHERIT_SET(name, flag, pool, cleanup)        \
25
#define APR_IMPLEMENT_INHERIT_SET(name, flag, pool, cleanup)        \
25
APR_DECLARE(apr_status_t) apr_##name##_inherit_set(apr_##name##_t *the##name) \
26
APR_DECLARE(apr_status_t) apr_##name##_inherit_set(apr_##name##_t *the##name) \
26
{                                                                   \
27
{                                                                   \
28
        HANDLE temp, hproc = GetCurrentProcess();                   \
29
        if (!DuplicateHandle(hproc, the##name->filehand,            \
30
                             hproc, &temp, 0, TRUE,                 \
31
                             DUPLICATE_SAME_ACCESS))                \
32
            return apr_get_os_error();                              \
33
        CloseHandle(the##name->filehand);                           \
34
        the##name->filehand = temp;                                 \
35
    return APR_SUCCESS;                                             \
36
}
37
38
#define APR_IMPLEMENT_INHERIT_UNSET(name, flag, pool, cleanup)      \
39
APR_DECLARE(apr_status_t) apr_##name##_inherit_unset(apr_##name##_t *the##name)\
40
{                                                                   \
41
        HANDLE temp, hproc = GetCurrentProcess();                   \
42
        if (!DuplicateHandle(hproc, the##name->filehand,            \
43
                             hproc, &temp, 0, FALSE,                \
44
                             DUPLICATE_SAME_ACCESS))                \
45
            return apr_get_os_error();                              \
46
        CloseHandle(the##name->filehand);                           \
47
        the##name->filehand = temp;                                 \
48
    return APR_SUCCESS;                                             \
49
}
50
#else
51
#define APR_IMPLEMENT_INHERIT_SET(name, flag, pool, cleanup)        \
52
APR_DECLARE(apr_status_t) apr_##name##_inherit_set(apr_##name##_t *the##name) \
53
{                                                                   \
27
    IF_WIN_OS_IS_UNICODE                                            \
54
    IF_WIN_OS_IS_UNICODE                                            \
28
    {                                                               \
55
    {                                                               \
29
        if (!SetHandleInformation(the##name->filehand,              \
56
        if (!SetHandleInformation(the##name->filehand,              \
Lines 65-69 Link Here
65
    }                                                               \
92
    }                                                               \
66
    return APR_SUCCESS;                                             \
93
    return APR_SUCCESS;                                             \
67
}
94
}
95
#endif
68
96
69
#endif	/* ! INHERIT_H */
97
#endif	/* ! INHERIT_H */

Return to bug 39886