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
ecde2807
Commit
ecde2807
authored
11 years ago
by
Steven Murray
Browse files
Options
Downloads
Patches
Plain Diff
Fixed missing option bug with bad use of getopt
parent
19189610
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
castor/tape/mediachanger/DismountAcsCmd.cpp
+7
-7
7 additions, 7 deletions
castor/tape/mediachanger/DismountAcsCmd.cpp
castor/tape/mediachanger/MountAcsCmd.cpp
+7
-7
7 additions, 7 deletions
castor/tape/mediachanger/MountAcsCmd.cpp
with
14 additions
and
14 deletions
castor/tape/mediachanger/DismountAcsCmd.cpp
+
7
−
7
View file @
ecde2807
...
...
@@ -156,7 +156,7 @@ castor::tape::mediachanger::DismountAcsCmdLine
// Prevent getopt() from printing an error message if it does not recognize
// an option character
opterr
=
0
;
while
((
c
=
getopt_long
(
argc
,
argv
,
"dfhq:t:"
,
longopts
,
NULL
))
!=
-
1
)
{
while
((
c
=
getopt_long
(
argc
,
argv
,
"
:
dfhq:t:"
,
longopts
,
NULL
))
!=
-
1
)
{
switch
(
c
)
{
case
'd'
:
...
...
@@ -172,7 +172,7 @@ castor::tape::mediachanger::DismountAcsCmdLine
cmdLine
.
queryInterval
=
atoi
(
optarg
);
if
(
0
>=
cmdLine
.
queryInterval
)
{
castor
::
exception
::
InvalidArgument
ex
;
ex
.
getMessage
()
<<
"
\t
Query value must be an integer greater than 0"
ex
.
getMessage
()
<<
"Query value must be an integer greater than 0"
": value="
<<
cmdLine
.
queryInterval
;
throw
ex
;
}
...
...
@@ -181,7 +181,7 @@ castor::tape::mediachanger::DismountAcsCmdLine
cmdLine
.
timeout
=
atoi
(
optarg
);
if
(
0
>=
cmdLine
.
timeout
)
{
castor
::
exception
::
InvalidArgument
ex
;
ex
.
getMessage
()
<<
"
\t
Timeout value must be an integer greater than 0"
ex
.
getMessage
()
<<
"Timeout value must be an integer greater than 0"
": value="
<<
cmdLine
.
timeout
;
throw
ex
;
}
...
...
@@ -189,7 +189,7 @@ castor::tape::mediachanger::DismountAcsCmdLine
case
':'
:
{
castor
::
exception
::
InvalidArgument
ex
;
ex
.
getMessage
()
<<
"
\t
The -"
<<
(
char
)
optopt
ex
.
getMessage
()
<<
"The -"
<<
(
char
)
optopt
<<
" option requires a parameter"
;
throw
ex
;
}
...
...
@@ -199,9 +199,9 @@ castor::tape::mediachanger::DismountAcsCmdLine
castor
::
exception
::
InvalidArgument
ex
;
if
(
optopt
==
0
)
{
ex
.
getMessage
()
<<
"
\t
Unknown command-line option"
;
ex
.
getMessage
()
<<
"Unknown command-line option"
;
}
else
{
ex
.
getMessage
()
<<
"
\t
Unknown command-line option: -"
<<
(
char
)
optopt
;
ex
.
getMessage
()
<<
"Unknown command-line option: -"
<<
(
char
)
optopt
;
}
throw
ex
;
}
...
...
@@ -210,7 +210,7 @@ castor::tape::mediachanger::DismountAcsCmdLine
{
castor
::
exception
::
Internal
ex
;
ex
.
getMessage
()
<<
"
\t
getopt_long returned the following unknown value: 0x"
<<
"getopt_long returned the following unknown value: 0x"
<<
std
::
hex
<<
(
int
)
c
;
throw
ex
;
}
...
...
This diff is collapsed.
Click to expand it.
castor/tape/mediachanger/MountAcsCmd.cpp
+
7
−
7
View file @
ecde2807
...
...
@@ -128,7 +128,7 @@ castor::tape::mediachanger::MountAcsCmdLine
// Prevent getopt() from printing an error message if it does not recognize
// an option character
opterr
=
0
;
while
((
c
=
getopt_long
(
argc
,
argv
,
"dhq:rt:"
,
longopts
,
NULL
))
!=
-
1
)
{
while
((
c
=
getopt_long
(
argc
,
argv
,
"
:
dhq:rt:"
,
longopts
,
NULL
))
!=
-
1
)
{
switch
(
c
)
{
case
'd'
:
...
...
@@ -141,7 +141,7 @@ castor::tape::mediachanger::MountAcsCmdLine
cmdLine
.
queryInterval
=
atoi
(
optarg
);
if
(
0
>=
cmdLine
.
queryInterval
)
{
castor
::
exception
::
InvalidArgument
ex
;
ex
.
getMessage
()
<<
"
\t
Query value must be an integer greater than 0"
ex
.
getMessage
()
<<
"Query value must be an integer greater than 0"
": value="
<<
cmdLine
.
queryInterval
;
throw
ex
;
}
...
...
@@ -153,7 +153,7 @@ castor::tape::mediachanger::MountAcsCmdLine
cmdLine
.
timeout
=
atoi
(
optarg
);
if
(
0
>=
cmdLine
.
timeout
)
{
castor
::
exception
::
InvalidArgument
ex
;
ex
.
getMessage
()
<<
"
\t
Timeout value must be an integer greater than 0"
ex
.
getMessage
()
<<
"Timeout value must be an integer greater than 0"
": value="
<<
cmdLine
.
timeout
;
throw
ex
;
}
...
...
@@ -161,7 +161,7 @@ castor::tape::mediachanger::MountAcsCmdLine
case
':'
:
{
castor
::
exception
::
InvalidArgument
ex
;
ex
.
getMessage
()
<<
"
\t
The -"
<<
(
char
)
optopt
ex
.
getMessage
()
<<
"The -"
<<
(
char
)
optopt
<<
" option requires a parameter"
;
throw
ex
;
}
...
...
@@ -171,9 +171,9 @@ castor::tape::mediachanger::MountAcsCmdLine
castor
::
exception
::
InvalidArgument
ex
;
if
(
optopt
==
0
)
{
ex
.
getMessage
()
<<
"
\t
Unknown command-line option"
;
ex
.
getMessage
()
<<
"Unknown command-line option"
;
}
else
{
ex
.
getMessage
()
<<
"
\t
Unknown command-line option: -"
<<
(
char
)
optopt
;
ex
.
getMessage
()
<<
"Unknown command-line option: -"
<<
(
char
)
optopt
;
}
throw
ex
;
}
...
...
@@ -182,7 +182,7 @@ castor::tape::mediachanger::MountAcsCmdLine
{
castor
::
exception
::
Internal
ex
;
ex
.
getMessage
()
<<
"
\t
getopt_long returned the following unknown value: 0x"
<<
"getopt_long returned the following unknown value: 0x"
<<
std
::
hex
<<
(
int
)
c
;
throw
ex
;
}
...
...
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