Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
cta
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
dCache
cta
Commits
48d0f532
Commit
48d0f532
authored
12 years ago
by
Sebastien Ponce
Committed by
Steven Murray
7 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Yet another round of coverity deffects fixes
parent
1a1b921d
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
mediachanger/castorrmc/common/Cregexp.c
+1
-1
1 addition, 1 deletion
mediachanger/castorrmc/common/Cregexp.c
mediachanger/castorrmc/common/socket_timeout.c
+1
-102
1 addition, 102 deletions
mediachanger/castorrmc/common/socket_timeout.c
with
2 additions
and
103 deletions
mediachanger/castorrmc/common/Cregexp.c
+
1
−
1
View file @
48d0f532
...
...
@@ -1638,7 +1638,7 @@ int Cregexp_sub(Cregexp_t *prog,
*/
char
*
_Cregexp_prop
(
char
*
op
)
{
char
*
p
;
char
*
p
=
NULL
;
static
char
buf
[
50
];
(
void
)
strcpy
(
buf
,
":"
);
...
...
This diff is collapsed.
Click to expand it.
mediachanger/castorrmc/common/socket_timeout.c
+
1
−
102
View file @
48d0f532
...
...
@@ -3,11 +3,6 @@
* All rights reserved
*/
#if defined(linux)
#define USE_POLL_INSTEAD_OF_SELECT
/* #define __FD_SETSIZE 65536 */
#endif
#include
<stdlib.h>
#include
<errno.h>
#include
<signal.h>
...
...
@@ -17,10 +12,7 @@
#include
<unistd.h>
#include
<sys/socket.h>
#include
<sys/ioctl.h>
#ifdef USE_POLL_INSTEAD_OF_SELECT
#include
<poll.h>
#endif
#include
"net.h"
#include
"serrno.h"
...
...
@@ -320,7 +312,6 @@ Sigfunc *_netsignal(int signo,
return
(
oact
.
sa_handler
);
}
#ifdef USE_POLL_INSTEAD_OF_SELECT
int
_net_isclosed
(
int
fd
)
{
struct
pollfd
pollit
;
...
...
@@ -339,32 +330,7 @@ int _net_isclosed(int fd)
}
return
0
;
}
#else
int
_net_isclosed
(
int
fd
)
{
fd_set
rset
;
struct
timeval
tv
;
char
buf
[
1
];
FD_ZERO
(
&
rset
);
FD_SET
(
fd
,
&
rset
);
tv
.
tv_sec
=
0
;
tv
.
tv_usec
=
0
;
/* Will return > 0 if the descriptor is closed */
if
(
select
(
fd
+
1
,
NULL
,
&
rset
,
NULL
,
&
tv
)
>
0
)
{
if
(
recv
(
fd
,
buf
,
sizeof
(
buf
),
MSG_PEEK
|
MSG_DONTWAIT
)
==
0
)
{
serrno
=
errno
;
return
1
;
}
}
return
0
;
}
#endif
#ifdef USE_POLL_INSTEAD_OF_SELECT
int
_net_writable
(
int
fd
,
int
timeout
)
{
...
...
@@ -377,25 +343,7 @@ int _net_writable(int fd,
/* Will return > 0 if the descriptor is writable */
return
(
poll
(
&
pollit
,
1
,
timeout
*
1000
));
}
#else
int
_net_writable
(
int
fd
,
int
timeout
)
{
fd_set
rset
;
struct
timeval
tv
;
FD_ZERO
(
&
rset
);
FD_SET
(
fd
,
&
rset
);
tv
.
tv_sec
=
timeout
;
tv
.
tv_usec
=
0
;
/* Will return > 0 if the descriptor is writable */
return
(
select
(
fd
+
1
,
NULL
,
&
rset
,
NULL
,
&
tv
));
}
#endif
#ifdef USE_POLL_INSTEAD_OF_SELECT
int
_net_readable
(
int
fd
,
int
timeout
)
{
...
...
@@ -408,56 +356,21 @@ int _net_readable(int fd,
/* Will return > 0 if the descriptor is readable */
return
(
poll
(
&
pollit
,
1
,
timeout
*
1000
));
}
#else
int
_net_readable
(
int
fd
,
int
timeout
)
{
fd_set
rset
;
struct
timeval
tv
;
FD_ZERO
(
&
rset
);
FD_SET
(
fd
,
&
rset
);
tv
.
tv_sec
=
timeout
;
tv
.
tv_usec
=
0
;
/* Will return > 0 if the descriptor is readable */
return
(
select
(
fd
+
1
,
&
rset
,
NULL
,
NULL
,
&
tv
));
}
#endif
int
_net_connectable
(
int
fd
,
int
timeout
)
{
#ifdef USE_POLL_INSTEAD_OF_SELECT
struct
pollfd
pollit
;
#else
fd_set
wset
,
eset
;
struct
timeval
tv
;
#endif
int
rc
,
errval
;
socklen_t
errval_len
;
#ifdef USE_POLL_INSTEAD_OF_SELECT
pollit
.
fd
=
fd
;
pollit
.
events
=
POLLOUT
;
pollit
.
revents
=
0
;
#else
FD_ZERO
(
&
wset
);
FD_SET
(
fd
,
&
wset
);
FD_ZERO
(
&
eset
);
FD_SET
(
fd
,
&
eset
);
tv
.
tv_sec
=
timeout
;
tv
.
tv_usec
=
0
;
#endif
/* Will return > 0 if the descriptor is connected */
#ifdef USE_POLL_INSTEAD_OF_SELECT
rc
=
poll
(
&
pollit
,
1
,
timeout
*
1000
);
#else
rc
=
select
(
fd
+
1
,
NULL
,
&
wset
,
&
eset
,
&
tv
);
#endif
/*
* Timeout ?
*/
...
...
@@ -489,21 +402,7 @@ int _net_connectable(int fd,
return
(
-
1
);
}
#ifdef USE_POLL_INSTEAD_OF_SELECT
if
(
errval
==
0
)
return
(
0
);
#else
if
(
(
FD_ISSET
(
fd
,
&
wset
))
&&
(
errval
==
0
)
)
return
(
0
);
/*
* For Windows it may happen that the getsockopt returns zero
* error value despite that the write set has not been set.
* Flag that an error occurred with SECOMERR. On windows we must
* set a valid socket error since WSAGetLastError() might be called.
* A good guess value is connection refused.
*/
if
(
errval
==
0
)
{
errval
=
SECOMERR
;
}
#endif
serrno
=
errval
;
return
(
-
1
);
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment