Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
liblongpath-rsync
Project
Project
Details
Activity
Releases
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
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
liblongpath
liblongpath-rsync
Commits
35276770
Commit
35276770
authored
Oct 08, 2011
by
Wayne Davison
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Let's cast getpid() to an int instead of a long for snprintf().
parent
fd91c3b6
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
19 additions
and
24 deletions
+19
-24
clientserver.c
clientserver.c
+1
-1
generator.c
generator.c
+1
-1
log.c
log.c
+3
-5
main.c
main.c
+7
-12
testrun.c
testrun.c
+2
-2
util.c
util.c
+5
-3
No files found.
clientserver.c
View file @
35276770
...
...
@@ -1121,7 +1121,7 @@ static void create_pid_file(void)
rsyserr
(
FLOG
,
errno
,
"failed to create pid file %s"
,
pid_file
);
exit_cleanup
(
RERR_FILEIO
);
}
snprintf
(
pidbuf
,
sizeof
pidbuf
,
"%
ld
\n
"
,
(
long
)
pid
);
snprintf
(
pidbuf
,
sizeof
pidbuf
,
"%
d
\n
"
,
(
int
)
pid
);
len
=
strlen
(
pidbuf
);
if
(
write
(
fd
,
pidbuf
,
len
)
!=
len
)
goto
failure
;
...
...
generator.c
View file @
35276770
...
...
@@ -2124,7 +2124,7 @@ void generate_files(int f_out, const char *local_name)
implied_dirs_are_missing
=
relative_paths
&&
!
implied_dirs
&&
protocol_version
<
30
;
if
(
DEBUG_GTE
(
GENR
,
1
))
rprintf
(
FINFO
,
"generator starting pid=%
ld
\n
"
,
(
long
)
getpid
());
rprintf
(
FINFO
,
"generator starting pid=%
d
\n
"
,
(
int
)
getpid
());
if
(
delete_before
&&
!
solo_file
&&
cur_flist
->
used
>
0
)
do_delete_pass
();
...
...
log.c
View file @
35276770
...
...
@@ -123,8 +123,7 @@ static void logit(int priority, const char *buf)
if
(
logfile_was_closed
)
logfile_reopen
();
if
(
logfile_fp
)
{
fprintf
(
logfile_fp
,
"%s [%d] %s"
,
timestring
(
time
(
NULL
)),
(
int
)
getpid
(),
buf
);
fprintf
(
logfile_fp
,
"%s [%d] %s"
,
timestring
(
time
(
NULL
)),
(
int
)
getpid
(),
buf
);
fflush
(
logfile_fp
);
}
else
{
syslog
(
priority
,
"%s"
,
buf
);
...
...
@@ -569,9 +568,8 @@ static void log_formatted(enum logcode code, const char *format, const char *op,
}
break
;
case
'p'
:
strlcat
(
fmt
,
"ld"
,
sizeof
fmt
);
snprintf
(
buf2
,
sizeof
buf2
,
fmt
,
(
long
)
getpid
());
strlcat
(
fmt
,
"d"
,
sizeof
fmt
);
snprintf
(
buf2
,
sizeof
buf2
,
fmt
,
(
int
)
getpid
());
n
=
buf2
;
break
;
case
'M'
:
...
...
main.c
View file @
35276770
...
...
@@ -364,7 +364,7 @@ static void show_malloc_stats(void)
rprintf
(
FCLIENT
,
"
\n
"
);
rprintf
(
FINFO
,
RSYNC_NAME
"[%d] (%s%s%s) heap statistics:
\n
"
,
getpid
(),
am_server
?
"server "
:
""
,
(
int
)
getpid
(),
am_server
?
"server "
:
""
,
am_daemon
?
"daemon "
:
""
,
who_am_i
());
rprintf
(
FINFO
,
" arena: %10ld (bytes from sbrk)
\n
"
,
(
long
)
mi
.
arena
);
...
...
@@ -774,10 +774,8 @@ static void do_server_sender(int f_in, int f_out, int argc, char *argv[])
struct
file_list
*
flist
;
char
*
dir
=
argv
[
0
];
if
(
DEBUG_GTE
(
SEND
,
1
))
{
rprintf
(
FINFO
,
"server_sender starting pid=%ld
\n
"
,
(
long
)
getpid
());
}
if
(
DEBUG_GTE
(
SEND
,
1
))
rprintf
(
FINFO
,
"server_sender starting pid=%d
\n
"
,
(
int
)
getpid
());
if
(
am_daemon
&&
lp_write_only
(
module_id
))
{
rprintf
(
FERROR
,
"ERROR: module is write only
\n
"
);
...
...
@@ -972,10 +970,8 @@ static void do_server_recv(int f_in, int f_out, int argc, char *argv[])
}
else
negated_levels
=
0
;
if
(
DEBUG_GTE
(
RECV
,
1
))
{
rprintf
(
FINFO
,
"server_recv(%d) starting pid=%ld
\n
"
,
argc
,
(
long
)
getpid
());
}
if
(
DEBUG_GTE
(
RECV
,
1
))
rprintf
(
FINFO
,
"server_recv(%d) starting pid=%d
\n
"
,
argc
,
(
int
)
getpid
());
if
(
am_daemon
&&
read_only
)
{
rprintf
(
FERROR
,
"ERROR: module is read only
\n
"
);
...
...
@@ -1491,10 +1487,9 @@ const char *get_panic_action(void)
static
RETSIGTYPE
rsync_panic_handler
(
UNUSED
(
int
whatsig
))
{
char
cmd_buf
[
300
];
int
ret
;
int
ret
,
pid_int
=
getpid
()
;
snprintf
(
cmd_buf
,
sizeof
cmd_buf
,
get_panic_action
(),
getpid
(),
getpid
());
snprintf
(
cmd_buf
,
sizeof
cmd_buf
,
get_panic_action
(),
pid_int
,
pid_int
);
/* Unless we failed to execute gdb, we allow the process to
* continue. I'm not sure if that's right. */
...
...
testrun.c
View file @
35276770
...
...
@@ -46,9 +46,9 @@
if
(
slept
++
>
timeout_secs
)
{
fprintf
(
stderr
,
"TESTRUN TIMEOUT: test took over %d seconds.
\n
"
,
timeout_secs
);
if
(
kill
(
pid
,
SIGTERM
)
<
0
)
fprintf
(
stderr
,
"TESTRUN ERROR: failed to kill pid %
ld: %s
\n
"
,
(
long
)
pid
,
strerror
(
errno
));
fprintf
(
stderr
,
"TESTRUN ERROR: failed to kill pid %
d: %s
\n
"
,
(
int
)
pid
,
strerror
(
errno
));
else
fprintf
(
stderr
,
"TESTRUN INFO: killed pid %
ld
\n
"
,
(
long
)
pid
);
fprintf
(
stderr
,
"TESTRUN INFO: killed pid %
d
\n
"
,
(
int
)
pid
);
exit
(
1
);
}
sleep
(
1
);
...
...
util.c
View file @
35276770
...
...
@@ -1358,11 +1358,13 @@ int cmp_time(time_t file1, time_t file2)
int
_Insure_trap_error
(
int
a1
,
int
a2
,
int
a3
,
int
a4
,
int
a5
,
int
a6
)
{
static
int
(
*
fn
)();
int
ret
;
int
ret
,
pid_int
=
getpid
()
;
char
*
cmd
;
asprintf
(
&
cmd
,
"/usr/X11R6/bin/xterm -display :0 -T Panic -n Panic -e /bin/sh -c 'cat /tmp/ierrs.*.%d ; gdb /proc/%d/exe %d'"
,
getpid
(),
getpid
(),
getpid
());
if
(
asprintf
(
&
cmd
,
"/usr/X11R6/bin/xterm -display :0 -T Panic -n Panic -e /bin/sh -c 'cat /tmp/ierrs.*.%d ; "
"gdb /proc/%d/exe %d'"
,
pid_int
,
pid_int
,
pid_int
)
<
0
)
return
-
1
;
if
(
!
fn
)
{
static
void
*
h
;
...
...
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