From 63924ef625479fd248d299ffbc8bab940f0e7bc7 Mon Sep 17 00:00:00 2001 From: Yehuda Sadeh Date: Sun, 3 Dec 2017 23:45:31 -0800 Subject: [PATCH] cls_otp: treat empty header as -ENOENT Signed-off-by: Yehuda Sadeh --- src/cls/otp/cls_otp.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/cls/otp/cls_otp.cc b/src/cls/otp/cls_otp.cc index 188345d56d9..d584df66bba 100644 --- a/src/cls/otp/cls_otp.cc +++ b/src/cls/otp/cls_otp.cc @@ -228,6 +228,11 @@ static int read_header(cls_method_context_t hctx, otp_header *h) return r; } + if (bl.length() == 0) { + *h = otp_header(); + return 0; + } + auto iter = bl.begin(); try { ::decode(*h, iter); -- 2.39.5