MCPcopy Create free account
hub / github.com/apache/cloudberry / GetDataDirectoryCreatePerm

Function GetDataDirectoryCreatePerm

src/common/file_perm.c:64–88  ·  view source on GitHub ↗

* Get the create modes and mask to use when writing to PGDATA by examining the * mode of the PGDATA directory and calling SetDataDirectoryCreatePerm(). * * Errors are not handled here and should be reported by the application when * false is returned. * * Suppress when on Windows, because there may not be proper support for Unix-y * file permissions. */

Source from the content-addressed store, hash-verified

62 * file permissions.
63 */
64bool
65GetDataDirectoryCreatePerm(const char *dataDir)
66{
67#if !defined(WIN32) && !defined(__CYGWIN__)
68 struct stat statBuf;
69
70 /*
71 * If an error occurs getting the mode then return false. The caller is
72 * responsible for generating an error, if appropriate, indicating that we
73 * were unable to access the data directory.
74 */
75 if (stat(dataDir, &statBuf) == -1)
76 return false;
77
78 /* Set permissions */
79 SetDataDirectoryCreatePerm(statBuf.st_mode);
80 return true;
81#else /* !defined(WIN32) && !defined(__CYGWIN__) */
82 /*
83 * On Windows, we don't have anything to do here since they don't have
84 * Unix-y permissions.
85 */
86 return true;
87#endif
88}
89
90
91#endif /* FRONTEND */

Callers 5

mainFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85

Calls 2

statClass · 0.70

Tested by

no test coverage detected