1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
$NetBSD: patch-ak,v 1.2 2006/08/06 22:23:56 christos Exp $
--- src/mkid.c.orig 2006-02-16 01:40:30.000000000 -0500
+++ src/mkid.c 2006-08-06 18:20:32.000000000 -0400
@@ -28,7 +28,6 @@
#include <pathmax.h>
#include <string.h>
#include <dirname.h>
-#include <alloca.h>
#include <limits.h>
#include <inttostr.h>
#include <xalloc.h>
@@ -40,8 +39,6 @@
#include "scanners.h"
#include "iduglobal.h"
-char* dirname(char* path);
-
struct summary
{
struct token **sum_tokens;
@@ -372,11 +369,21 @@
{
if (errno == ENOENT)
{
- char const *dirname = dir_name ((char*)filename);
- if (access (dirname, 06) < 0)
+ char *dir_copy, *dir_name = strrchr (filename, '/');
+ if (dir_name)
+ {
+ while (*--dir_name == '/')
+ continue;
+ dir_name++;
+ dir_copy = strdup(filename);
+ dir_copy[dir_name - filename] = '\0';
+ }
+ else
+ dir_copy = strdup(".");
+ if (access (dir_copy, 06) < 0)
error (1, errno, _("can't create `%s' in `%s'"),
- base_name (filename), dirname);
- free(dirname);
+ base_name (filename), dir_copy);
+ free(dir_copy);
}
else
error (1, errno, _("can't modify `%s'"), filename);
@@ -450,7 +457,7 @@
source_FILE = fopen (flink->fl_name, "r");
if (source_FILE)
{
- char *file_name = alloca (PATH_MAX);
+ char file_name[PATH_MAX];
if (statistics_flag)
{
if (fstat (fileno (source_FILE), &st) < 0)
|