Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
c31a3641
Commit
c31a3641
authored
Jan 12, 2009
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
makedep: Copy the makefile to append dependencies instead of truncating in place.
parent
f885d40d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
50 additions
and
9 deletions
+50
-9
makedep.c
tools/makedep.c
+50
-9
No files found.
tools/makedep.c
View file @
c31a3641
...
@@ -866,6 +866,33 @@ static int output_src( FILE *file, INCL_FILE *pFile, int *column )
...
@@ -866,6 +866,33 @@ static int output_src( FILE *file, INCL_FILE *pFile, int *column )
/*******************************************************************
/*******************************************************************
* create_temp_file
*/
static
FILE
*
create_temp_file
(
char
**
tmp_name
)
{
char
*
name
=
xmalloc
(
strlen
(
OutputFileName
)
+
13
);
unsigned
int
i
,
id
=
getpid
();
int
fd
;
FILE
*
ret
=
NULL
;
for
(
i
=
0
;
i
<
100
;
i
++
)
{
sprintf
(
name
,
"%s.tmp%08x"
,
OutputFileName
,
id
);
if
((
fd
=
open
(
name
,
O_RDWR
|
O_CREAT
|
O_EXCL
,
0600
))
!=
-
1
)
{
ret
=
fdopen
(
fd
,
"w"
);
break
;
}
if
(
errno
!=
EEXIST
)
break
;
id
+=
7777
;
}
if
(
!
ret
)
fatal_error
(
"failed to create output file for '%s'
\n
"
,
OutputFileName
);
*
tmp_name
=
name
;
return
ret
;
}
/*******************************************************************
* output_dependencies
* output_dependencies
*/
*/
static
void
output_dependencies
(
void
)
static
void
output_dependencies
(
void
)
...
@@ -873,19 +900,23 @@ static void output_dependencies(void)
...
@@ -873,19 +900,23 @@ static void output_dependencies(void)
INCL_FILE
*
pFile
;
INCL_FILE
*
pFile
;
int
i
,
column
;
int
i
,
column
;
FILE
*
file
=
NULL
;
FILE
*
file
=
NULL
;
char
*
buffer
;
char
*
tmp_name
=
NULL
;
if
(
Separator
&&
((
file
=
fopen
(
OutputFileName
,
"r
+
"
))))
if
(
Separator
&&
((
file
=
fopen
(
OutputFileName
,
"r"
))))
{
{
while
((
buffer
=
get_line
(
file
)))
char
buffer
[
1024
];
FILE
*
tmp_file
=
create_temp_file
(
&
tmp_name
);
while
(
fgets
(
buffer
,
sizeof
(
buffer
),
file
))
{
{
if
(
strncmp
(
buffer
,
Separator
,
strlen
(
Separator
)
))
continue
;
if
(
fwrite
(
buffer
,
1
,
strlen
(
buffer
),
tmp_file
)
!=
strlen
(
buffer
))
ftruncate
(
fileno
(
file
),
ftell
(
file
)
);
fatal_error
(
"error writing to %s
\n
"
,
tmp_name
);
fseek
(
file
,
0L
,
SEEK_END
);
if
(
!
strncmp
(
buffer
,
Separator
,
strlen
(
Separator
)
))
break
;
break
;
}
}
fclose
(
file
);
file
=
tmp_file
;
}
}
if
(
!
file
)
else
{
{
if
(
!
(
file
=
fopen
(
OutputFileName
,
Separator
?
"a"
:
"w"
)))
if
(
!
(
file
=
fopen
(
OutputFileName
,
Separator
?
"a"
:
"w"
)))
{
{
...
@@ -902,7 +933,17 @@ static void output_dependencies(void)
...
@@ -902,7 +933,17 @@ static void output_dependencies(void)
pFile
,
&
column
);
pFile
,
&
column
);
fprintf
(
file
,
"
\n
"
);
fprintf
(
file
,
"
\n
"
);
}
}
fclose
(
file
);
fclose
(
file
);
if
(
tmp_name
)
{
if
(
rename
(
tmp_name
,
OutputFileName
)
==
-
1
)
{
unlink
(
tmp_name
);
fatal_error
(
"failed to rename output file to '%s'
\n
"
,
OutputFileName
);
}
free
(
tmp_name
);
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment