Git Product home page Git Product logo

Comments (10)

0-wiz-0 avatar 0-wiz-0 commented on June 12, 2024

There is not enough information here.
errno is suppopsed to be set by the operating system when an error occurs, not by an application library.

from libzip.

1397436824 avatar 1397436824 commented on June 12, 2024

The following example will illustrate the issue of errno being libzip:
image

from libzip.

1397436824 avatar 1397436824 commented on June 12, 2024

这里没有足够的信息。 errno 应该由操作系统在发生错误时设置,而不是由应用程序库设置。

As long as compile with - lzip, errno will be set to 2

from libzip.

0-wiz-0 avatar 0-wiz-0 commented on June 12, 2024

Please read up on errno some more - at the point where you are checking it, the value of errno is undefined.

from libzip.

1397436824 avatar 1397436824 commented on June 12, 2024

Please read up on errno some more - at the point where you are checking it, the value of errno is undefined.

Obviously, it's a problem with libzip. I've never seen a reference to another library where errno is not zero. If you can find another library that references errno that is not zero, then I believe you.
image

from libzip.

1397436824 avatar 1397436824 commented on June 12, 2024

Please read up on errno some more - at the point where you are checking it, the value of errno is undefined.

Obviously, it's a problem with libzip. I've never seen a reference to another library where errno is not zero. If you can find another library that references errno that is not zero, then I believe you. image

I am working on a large project, using dozens of libraries and debugging for a long time. I found this issue with libzip

from libzip.

dillof avatar dillof commented on June 12, 2024

libcurses also sets errno to non-zero during it's initialisation.

But all that is besides the point: according to the standard, the value of errno is undefined unless an error occurred. That means, you can't rely on it's value, even if it happens to be 0 on your system; it might not be on other systems.

from libzip.

1397436824 avatar 1397436824 commented on June 12, 2024

libcurses 还在初始化期间将 errno 设置为非零。

但这一切都不是重点:根据标准,除非发生错误,否则errno 的值是_未定义的。_这意味着,您不能依赖它的价值,即使它恰好0在您的系统上;它可能不在其他系统上。

Okay, but it's still recommended to set up errno and standardize it just like the Linux system library

from libzip.

dillof avatar dillof commented on June 12, 2024

No, for a library, it's recommended to leave errno alone unless you explicitly set it in case of an error.

If you want it to be 0 at a specific point in your program, set it yourself exactly there.

from libzip.

dillof avatar dillof commented on June 12, 2024

Also, have you tested if it is set by any of the library libzip links against and not by libzip itself? (zlib, lzma, bz2, …)

from libzip.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.