1
0
mirror of https://github.com/samba-team/samba.git synced 2025-12-12 12:23:50 +03:00

Added "inherit permissions" patch.

Fixed locking bug found by Andrew.
Jeremy.
This commit is contained in:
Jeremy Allison
-
parent f8bebf91ab
commit 38dffd360d
10 changed files with 122 additions and 33 deletions

View File

@@ -3280,3 +3280,31 @@ char *lock_path(char *name)
return fname;
}
/*******************************************************************
Given a filename - get its directory name
NB: Returned in static storage. Caveats:
o Not safe in thread environment.
o Caller must not free.
o If caller wishes to preserve, they should copy.
********************************************************************/
char *parent_dirname(const char *path)
{
static pstring dirpath;
char *p;
if (!path)
return(NULL);
pstrcpy(dirpath, path);
p = strrchr(dirpath, '/'); /* Find final '/', if any */
if (!p) {
pstrcpy(dirpath, "."); /* No final "/", so dir is "." */
} else {
if (p == dirpath)
++p; /* For root "/", leave "/" in place */
*p = '\0';
}
return dirpath;
}