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:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user