* Regarding EFBIG error while opening a file using catopen() function
@ 2022-12-12 5:10 Kavita Gore
0 siblings, 0 replies; only message in thread
From: Kavita Gore @ 2022-12-12 5:10 UTC (permalink / raw)
To: cygwin, cygwin-owner, mailman, cygwin-developers,
cygwin-developers-owner
Cc: parulsoni799, atulpathare226, rajeshrube
[-- 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.
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-12-12 5:10 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-12 5:10 Regarding EFBIG error while opening a file using catopen() function Kavita Gore
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).