From b1e2262cffa8f42e36c1e4ae796513d2fca67028 Mon Sep 17 00:00:00 2001 From: Greg Stein Date: Fri, 25 Jan 2002 00:17:31 +0000 Subject: [PATCH] Fix some serious, hard-core breakage :-( I don't even know how it compiled and linked. * there is no UNIX symbol, so go back to #ifndef WIN32. that other platforms can pile on as needed until we have a proper mechanism. * reinstate the liveprop callbacks and the dav_hooks_liveprop_fs structure. since the latter structure is referred to elsewhere in the file, it better be defined. * use a "feature" name of DAV_FS_HAS_EXECUTABLE rather than conditionally specifying the property. convert the tests over to that symbol. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@93012 13f79535-47bb-0310-9956-ffa450edef68 --- modules/dav/fs/repos.c | 38 ++++++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/modules/dav/fs/repos.c b/modules/dav/fs/repos.c index 29203d4ffe..ffed26aee7 100644 --- a/modules/dav/fs/repos.c +++ b/modules/dav/fs/repos.c @@ -152,17 +152,23 @@ enum { DAV_FS_URI_MYPROPS /* the namespace URI for our custom props */ }; +/* +** Does this platform support an executable flag? +** +** ### need a way to portably abstract this query +*/ +#ifndef WIN32 +#define DAV_FS_HAS_EXECUTABLE +#endif + /* ** The single property that we define (in the DAV_FS_URI_MYPROPS namespace) -** XXX this property is not usable (readable/writable) on all platforms -** Need an abstract way to determine this. */ -#ifdef UNIX #define DAV_PROPID_FS_executable 1 -#endif static const dav_liveprop_spec dav_fs_props[] = { + /* standard DAV properties */ { DAV_FS_URI_DAV, "creationdate", @@ -187,14 +193,15 @@ static const dav_liveprop_spec dav_fs_props[] = DAV_PROPID_getlastmodified, 0 }, -#ifdef DAV_PROPID_FS_executable + + /* our custom properties */ { DAV_FS_URI_MYPROPS, "executable", DAV_PROPID_FS_executable, 0 /* handled special in dav_fs_is_writable */ }, -#endif + { 0 } /* sentinel */ }; @@ -1868,7 +1875,7 @@ static dav_prop_insert dav_fs_insert_prop(const dav_resource *resource, buf); value = buf; break; -#ifdef DAV_PROPID_FS_executable + case DAV_PROPID_FS_executable: /* our property, but not defined on collection resources */ if (resource->collection) @@ -1884,7 +1891,7 @@ static dav_prop_insert dav_fs_insert_prop(const dav_resource *resource, else value = "F"; break; -#endif + default: /* ### what the heck was this property? */ return DAV_PROP_INSERT_NOTDEF; @@ -1919,14 +1926,16 @@ static dav_prop_insert dav_fs_insert_prop(const dav_resource *resource, return what; } -#ifdef DAV_PROPID_FS_executable - static int dav_fs_is_writable(const dav_resource *resource, int propid) { const dav_liveprop_spec *info; +#ifdef DAV_FS_HAS_EXECUTABLE + /* if we have the executable property, and this isn't a collection, + then the property is writable. */ if (propid == DAV_PROPID_FS_executable && !resource->collection) return 1; +#endif (void) dav_get_liveprop_info(propid, &dav_fs_liveprop_group, &info); return info->is_writable; @@ -2067,6 +2076,7 @@ static dav_error *dav_fs_patch_rollback(const dav_resource *resource, return NULL; } + static const dav_hooks_liveprop dav_hooks_liveprop_fs = { dav_fs_insert_prop, @@ -2078,8 +2088,6 @@ static const dav_hooks_liveprop dav_hooks_liveprop_fs = dav_fs_patch_rollback }; -#endif /* DAV_PROPID_FS_executable */ - static const dav_provider dav_fs_provider = { &dav_hooks_repository_fs, @@ -2091,7 +2099,7 @@ static const dav_provider dav_fs_provider = void dav_fs_gather_propsets(apr_array_header_t *uris) { -#ifdef DAV_PROPID_FS_executable +#ifdef DAV_FS_HAS_EXECUTABLE *(const char **)apr_array_push(uris) = ""; #endif @@ -2132,7 +2140,9 @@ void dav_fs_insert_all_liveprops(request_rec *r, const dav_resource *resource, what, phdr); (void) dav_fs_insert_prop(resource, DAV_PROPID_getetag, what, phdr); -#ifdef DAV_PROPID_FS_executable + +#ifdef DAV_FS_HAS_EXECUTABLE + /* Only insert this property if it is defined for this platform. */ (void) dav_fs_insert_prop(resource, DAV_PROPID_FS_executable, what, phdr); #endif -- 2.40.0