- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- vsnprintf is not working properly on HP-UX Itanium
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-29-2009 04:48 AM
тАО04-29-2009 04:48 AM
void test_emptyBuffer()
{
const o_4b stringLengthWithoutNull = 4;
const o_4b bufferSize = 0;
char buf[2];
clearBuffer(buf, 2);
o_4b returnValue = vs_snprintf(buf, (size_t) bufferSize, "%s", "emil");
cout<< "returnValue is:"<< returnValue <
cout<< "resultString is:"<< resultString<
cout<< "expectedString is:"<< expectedString<
TS_ASSERT_EQUALS(returnValue, stringLengthWithoutNull, "return value");
}
vs_snprintf is Wrapper for the functions vsnprintf
o_4b vs_snprintf(char *buf, size_t count, char* format, ...)
{
va_list argp;
va_start(argp, format);
o_4b result = 0;
result = vsnprintf(buf, count, format, argp);
va_end(argp);
if (result < 0)
{
va_start(argp, format);
result = vs_scprintfInternal(format, argp);
va_end(argp);
}
return result;
}
After running this program:
even if the bufferSize is 0 (means count is 0) ,vs_snprintf(ultimately vsnprintf) function write "emil" string into the buf
Why is it so?
It should not write anything into the buf as we are specifying bufferSize as zero
fyi ...
Below are the more values
returnValue is:4
resultString is:emil
expectedString is:*
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-29-2009 04:59 AM
тАО04-29-2009 04:59 AM
Re: vsnprintf is not working properly on HP-UX Itanium
Perhaps grace us with your OS version.
You might try a bi-annual patch update or search the http://itrc.hp.com batch database for a patch that applies to the command you are using.
You might try updating your development libraries.
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-29-2009 08:34 AM
тАО04-29-2009 08:34 AM
Re: vsnprintf is not working properly on HP-UX Itanium
>It should not write anything into the buf as we are specifying bufferSize as zero
I thought I've seen a bug where it writes one byte but not more?
As SEP said, you need to mention the OS version. vsnprintf(3) will not work correctly unless you are on 11.31 and you ask for Unix 2003 branding. But writing to the buffer with length zero, shouldn't be one of the accepted results.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-29-2009 05:48 PM
тАО04-29-2009 05:48 PM
Re: vsnprintf is not working properly on HP-UX Itanium
This was discussed in:
http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1320687
I'm not sure if there is a bug report for this for 11.23? It works for 11.31.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-29-2009 10:30 PM
тАО04-29-2009 10:30 PM
Re: vsnprintf is not working properly on HP-UX Itanium
about OS version :
the o/p of uname -a is
HP-UX hermes B.11.23 U ia64 2917453674 unlimited-user license
It means os version is 11.23
@Dennis
> I thought I've seen a bug where it writes one byte but not more?
In my case case it is writing more than one byte
>I'm not sure if there is a bug report for this for 11.23?
Can you please confirm me whether this is a known bug for 11.23?
So that next path is clear
As you said,vsnprintf will not work correctly unless you are on 11.31 and the os version which I am working on is 11.23.
So the question is how should I upgrade this os version?(ofcourse by applying patch)
@SEP:
>You might try a bi-annual patch update
where is this patch located(exact location)?
Before doing this,is there any alternative function available for vsnprintf function?
So that I can use it in my case
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-29-2009 11:57 PM
тАО04-29-2009 11:57 PM
Re: vsnprintf is not working properly on HP-UX Itanium
I'm not sure if it was ever reported. Or if it was and only fixed on 11.31?
>So the question is how should I upgrade this OS version? (of course by applying patch)
11.31 is a whole NEW OS version. No patching possible. (Unless you contact the Response Center and you report the problem.)
>is there any alternative function available for vsnprintf function?
Not really. Unless you check for length 0 and allocate/then free some "large" buffer.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-30-2009 02:45 AM
тАО04-30-2009 02:45 AM
Re: vsnprintf is not working properly on HP-UX Itanium
I am not getting what you are trying to say.
Can you please explain it more?
(Does this resolve the problem?)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-30-2009 02:48 AM
тАО04-30-2009 02:48 AM
Re: vsnprintf is not working properly on HP-UX Itanium
In reply to your @SEP
http://www11.itrc.hp.com/service/patch/mainPage.do
That is the patch database. There are links to the bi-annual patch sets on that site.
The best download method if possible is ftp script.
Also note that the site is very good at building larger patch sets that include needed dependent patches.
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-30-2009 03:23 AM
тАО04-30-2009 03:23 AM
Re: vsnprintf is not working properly on HP-UX Itanium
Another thing to think about on the patching front is SWA.
http://software.hp.com/portal/swdepot/displayProductInfo.do?productNumber=B6834AA
This is a very helpful tool in building patch sets.
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-30-2009 09:31 PM
тАО04-30-2009 09:31 PM
Solutionchar *p = buf;
char big_buf[1024];
if (count == 0) // workaround
p = big_buf;
result = vsnprintf(p, count, format, argp);
va_end(argp);
>Does this resolve the problem?
No, it works around the problem, a kludge.