File tree 1 file changed +8
-2
lines changed
1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -61,18 +61,24 @@ LinkSync::LinkSync(DBConnector *appl_db, DBConnector *state_db) :
61
61
cmd = " cat /sys/class/net/" + key + " /operstate" ;
62
62
try
63
63
{
64
- exec (cmd, res);
64
+ EXEC_WITH_ERROR_THROW (cmd, res);
65
65
}
66
66
catch (...)
67
67
{
68
68
SWSS_LOG_WARN (" Failed to get %s oper status" , key.c_str ());
69
69
continue ;
70
70
}
71
+
71
72
/* Remove the trailing newline */
72
- if (res.length () > 1 && res.at (res.length () - 1 ) == ' \n ' )
73
+ if (res.length () >= 1 && res.at (res.length () - 1 ) == ' \n ' )
73
74
{
74
75
res.erase (res.length () - 1 );
75
76
/* The value of operstate will be either up or down */
77
+ if (res != " up" && res != " down" )
78
+ {
79
+ SWSS_LOG_WARN (" Unknown %s oper status %s" ,
80
+ key.c_str (), res.c_str ());
81
+ }
76
82
FieldValueTuple fv (" oper_status" , res);
77
83
vector<FieldValueTuple> fvs;
78
84
fvs.push_back (fv);
You can’t perform that action at this time.
0 commit comments