public inbox for cygwin-developers@cygwin.com
 help / color / mirror / Atom feed
From: Kavita Gore <kavitagore02@gmail.com>
To: cygwin@cygwin.com, cygwin-owner@cygwin.com, mailman@cygwin.com,
	 cygwin-developers@cygwin.com,
	cygwin-developers-owner@cygwin.com
Cc: parulsoni799@gmail.com, atulpathare226@gmail.com, rajeshrube@gmail.com
Subject: Regarding EFBIG error while opening a file using catopen() function
Date: Mon, 12 Dec 2022 10:40:20 +0530	[thread overview]
Message-ID: <CAM=9zcQsWHZ_udeTuz0wHFK9vPY1DitEGJVRM3s2-+Doa8L7jA@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1424 bytes --]

Hi all,

I'm getting errno 27[EFBIG] file too large while opening catalogue with
catopen() function in the cygwin-32bit version.



Trying to open a .cat file but catopen() returns a file too large [EFBIG]
error.



this is the code snippet I was working with:



#define FILENAME    TEMP.CAT



   buffer = catopen(FILENAME, 0);

        if (buffer != (nl_catd) - 1)

         {

            printf("File open successfully");

        }

        else

        {

            printf("errno: %d\n", errno);

        }





While debugging using gdb.I've found that st.st_size is 0 and As per my
understanding struct stat.st_size is declared as off_t, which is most
probably signed, and resolves to long (signed by default).

So if SIZE_T_MAX does not fit into 2^31-1 (it most probably does not) it
will appear as negative in the comparison.

I suspect like off_t is supposed to be signed, and size_t is supposed to be
unsigned, both according to POSIX.

That means, this comparison has definitely a signedness issue.

So that's why if condition getting success and returning errno 27(EFBIG).



Coding snippet where if condition getting succeed:

Msgcat.c:

=======

if (st.st_size > SIZE_T_MAX) {

        _close(fd);

        SAVEFAIL(name, lang, EFBIG);

        NLRETERR(EFBIG);

    }


I'd like to know the reason why I'm getting this error and How it can be
resolved as it is a blocker in my task.


Regards,

Kavita.

                 reply	other threads:[~2022-12-12  5:10 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAM=9zcQsWHZ_udeTuz0wHFK9vPY1DitEGJVRM3s2-+Doa8L7jA@mail.gmail.com' \
    --to=kavitagore02@gmail.com \
    --cc=atulpathare226@gmail.com \
    --cc=cygwin-developers-owner@cygwin.com \
    --cc=cygwin-developers@cygwin.com \
    --cc=cygwin-owner@cygwin.com \
    --cc=cygwin@cygwin.com \
    --cc=mailman@cygwin.com \
    --cc=parulsoni799@gmail.com \
    --cc=rajeshrube@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).