Fix decompression of truncated data
[folly.git] / folly / Exception.h
index 30444b2bdaa193f17a0eb6764b20294cb95b45f4..28e0793816dbfcf448416fe5e441623792be1d1b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2016 Facebook, Inc.
+ * Copyright 2017 Facebook, Inc.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -14,8 +14,7 @@
  * limitations under the License.
  */
 
-#ifndef FOLLY_EXCEPTION_H_
-#define FOLLY_EXCEPTION_H_
+#pragma once
 
 #include <errno.h>
 
@@ -67,7 +66,7 @@ void checkPosixError(int err, Args&&... args) {
 template <class... Args>
 void checkKernelError(ssize_t ret, Args&&... args) {
   if (UNLIKELY(ret < 0)) {
-    throwSystemErrorExplicit(-ret, std::forward<Args>(args)...);
+    throwSystemErrorExplicit(int(-ret), std::forward<Args>(args)...);
   }
 }
 
@@ -119,5 +118,3 @@ void throwOnFail(V&& value, Args&&... args) {
   ::folly::throwOnFail<E>((cond), "Check failed: " #cond)
 
 }  // namespace folly
-
-#endif /* FOLLY_EXCEPTION_H_ */