Commit of the code which was suggested by Georg as a fix for:
[cake.git] / rom / dos / duplock.c
blobbe35c8239978d077137b7d0f4f2614032d0b055b
1 /*
2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: dos.library function DupLock()
6 Lang: english
7 */
8 #include <proto/exec.h>
9 #include "dos_intern.h"
11 /*****************************************************************************
13 NAME */
14 #include <proto/dos.h>
16 AROS_LH1(BPTR, DupLock,
18 /* SYNOPSIS */
19 AROS_LHA(BPTR, lock, D1),
21 /* LOCATION */
22 struct DosLibrary *, DOSBase, 16, Dos)
24 /* FUNCTION
25 Clone a lock on a file or directory. This will only work on shared
26 locks.
28 INPUTS
29 lock - Old lock.
31 RESULT
32 The new lock or NULL in case of an error. IoErr() will give additional
33 information in that case.
35 NOTES
36 This function is identical to DupLockFromFH().
38 EXAMPLE
40 BUGS
42 SEE ALSO
44 INTERNALS
46 *****************************************************************************/
48 /*****************************************************************************
50 NAME
51 #include <clib/dos_protos.h>
53 AROS_LH1(BPTR, DupLockFromFH,
55 SYNOPSIS
56 AROS_LHA(BPTR, fh, D1),
58 LOCATION
59 struct DosLibrary *, DOSBase, 62, Dos)
61 FUNCTION
62 Try to get a lock on the object selected by the filehandle.
64 INPUTS
65 fh - filehandle.
67 RESULT
68 The new lock or 0 in case of an error. IoErr() will give additional
69 information in that case.
71 NOTES
72 This function is identical to DupLock().
74 EXAMPLE
76 BUGS
78 SEE ALSO
80 INTERNALS
82 *****************************************************************************/
83 /*AROS alias DupLockFromFH DupLock */
85 AROS_LIBFUNC_INIT
87 BPTR old, new;
89 /* Use Lock() to clone the handle. cd to it first. */
90 old = CurrentDir(lock);
91 new=Lock("",SHARED_LOCK);
92 CurrentDir(old);
93 return new;
94 AROS_LIBFUNC_EXIT
95 } /* DupLock */