File tree Expand file tree Collapse file tree 1 file changed +3
-7
lines changed Expand file tree Collapse file tree 1 file changed +3
-7
lines changed Original file line number Diff line number Diff line change 2
2
3
3
#include <ctype.h>
4
4
#include <fcntl.h>
5
+ #include <libgen.h>
5
6
#include <poll.h>
6
7
#include <stdarg.h>
7
8
#include <sys/stat.h>
15
16
# include <sys/random.h>
16
17
#endif
17
18
18
- /* When we include libgen.h because we need dirname() we immediately
19
- * undefine basename() since libgen.h defines it as a macro to the
20
- * POSIX version which is really broken. We prefer GNU basename(). */
21
- #include <libgen.h>
22
- #undef basename
23
-
24
19
#include "def.h"
25
20
#include "time-util.h"
26
21
#include "util.h"
@@ -482,7 +477,8 @@ int tempfn_random(const char *p, char **ret) {
482
477
* /foo/bar/.#waldobaa2a261115984a9
483
478
*/
484
479
485
- fn = basename (p );
480
+ fn = strrchr (p , '/' );
481
+ fn = fn ? fn + 1 : p ;
486
482
if (!filename_is_valid (fn ))
487
483
return - EINVAL ;
488
484
You can’t perform that action at this time.
0 commit comments