Amber Jain's weblog (OLD)

Visit my new weblog at

Posts Tagged ‘Openbsd

g++ warnings on OpenBSD: “strcpy() is almost always misused, please use strlcpy()” and “strcat() is almost always misused, please use strlcat()”

with 4 comments

strcpy() and strcat() related warnings on OpenBSD with gcc/g++

I have a box with OpenBSD 4.5 installed. When compiling c++ programs using g++, I get following warnings:

/usr/lib/ warning: strcpy() is almost always misused, please use strlcpy()
/usr/lib/ warning: strcat() is almost always misused, please use strlcat()
Well, “Unix Programming Tools” from Stanford’s website says:
“Getting used to compiles that produce “a few warnings” is a very bad habit”.

I asked the reason for these warnings on ##c++-basic on The guys there suggested me some options (e.g. -Wno-deprecated, -Wno-deprecated-declarations)

Then somehow this thought strike my mind. What if this has something to do with ‘propolice’? OR What if this is OpenBSD related issue (?) OpenBSD strives hard to be secure. Although, not all OpenBSD packages go through rigorous security audit, but then gcc is something that is likely to be ‘modified’ to fit OpenBSD’s goals. So, I asked this on #openbsd (at freenode). Here’s the IRC log:

AmberJ> Why does gcc/g++ outputs 2 warnings: “strcpy() is almost always misused, please use strlcpy() [and the same with strcat]”….Is it because openbsd has propolice enabled?
….because I don’t seem to encounter those warnings on other OSes with propolice disabled
AmberJ: it’s a linking warning, you’ll only see it when you link something that uses strcpy() etc
oenone, But why those warnings pop up only on OpenBSD ?
AmberJ: because other OSes don’t have the warnings in their version of libc

I updated this info to ##c++-basic. IRC-log:

AmberJ> That’s it! I hope that is the answer to my original question
jps_77, SukhE metabol Leoneof` thanks all πŸ™‚
AmberJ: that was a retarded reply that you got in #openbsd
try in #gcc

I then tried at #gcc as suggested(at freenode). IRC log:

AmberJ> Why does gcc/g++ outputs 2 warnings: “strcpy() is almost always misused, please use strlcpy() [and the same with strcat]”….Is it because openbsd has propolice enabled?
I’m using gcc 3.3.5 (propolice)
Ofcourse, I’m using OpenBSD 4.5
AmberJ: that sounds a lot like OpenBSD broke it. (they invented those l forms)
noshadow, Someone at #openbsd mentioned: “Other OSes don’t hae similar warnings because other OSes don’t have the warnings in their version of libc”
AmberJ: yes, that’s a possible place where they could have put those uncessary warnings.
noshadow, ok ty πŸ™‚
though the warning is really the wrong way round. why strcpy is usefull often, strlcpy is always always misused…

Ofcourse, you can feel the ‘anti-openbsd’ feeling in the air πŸ˜‰

In the end, the folks at ##c++-basic suggested me that I try to install a newer version of gcc i.e. 4.x (mind you, gcc/g++ 3.3.5-propolice is the version that is shipped with OpenBSD 4.5) and if this problem persists (Is this really a problem? Read this. I suppose the warning is apt.), they suggested that I try to compile gcc from source.

More soon.



Written by Amber Jain

January 9, 2010 at 1:24 PM

OpenBSD Docs

with 2 comments

All the OpenBSD related (official and unoffcial by various users) documentation will be linked here. I plan to move this one to my website once I’m done with it’s layout.

man pages

Written by Amber Jain

November 30, 2009 at 4:09 PM

Posted in Openbsd

Tagged with , ,

Adobe Flash on OpenBSD

leave a comment »


I personally prefer to download youtube etc. videos first and then watch them using Mplayer etc. but here are some useful links if you really want to use Adobe Flash on OpenBSD:

Link 1
Link 2
Link 3

Update 1: swfdec ( is also an option other than gnash on OpenBSD (or atleast it seems so) although I have not personally tried swfdec).

Update 2:
Planning to rearrange stuff. Soon.

Written by Amber Jain

November 12, 2009 at 5:20 AM

Posted in Openbsd

Tagged with , , ,

Recursively search sub-directories in a directory to delete a file with a specific name

leave a comment »


@Windows OS users: Sometimes when a malware simply installs itself recursively in all the sub-directories (starting from root i.e. C:) with the same name, you need to delete each file. Manual deletion is not usually possible when there are thousands of malware files. This could prove useful to you.
And yes, use some ‘better’ OS if you can.

On ##unix at, someone (justinko) asked a question that goes like:
Que: How to recursively search all sub-directories in a directory to delete a file with a specific name?

Answer: Rather than providing only the answer, I prefer putting the complete IRC log here (mind you, ‘justinko’ and ‘Riviera’ are the nicks of persons involved in this conversation):
justinko how do I delete a file in every sub directory?
justinko im in a directory that has directores, and inside those directories there is one file that needs to be deleted
Riviera with a particular name?
justinko yes
justinko I know the exact file name
Riviera okay
Riviera find directory/ -type f -name 'exact_filename' -exec rm -f -- {} +
justinko is find a command?
Riviera yes
justinko the sub-directories are all named differently
Riviera some finds (actually I only know about GNU find) even have the primary -delete
Riviera yes
Riviera i figured
Riviera The find command I gave you recusively checks all files in the "directory/" hierarchy for files with the name "exact_filename",
Riviera executing the command "rm -f --" with the found pathnames as parameters.
Riviera recursively*
Riviera If you want to learn more about find, read this:
Riviera note that some of the examples given there are related to the bash-shell.
justinko damn that worked
Riviera I'm glad :)
justinko what is - type f ?
justinko I know rm -f is "force remove"
Riviera restricts the filetype to "ordinary files"
justinko k
justinko what does {} mean?
Riviera so that even if you'd have directories with the same name as the files you wish to remove, would be left alone
Riviera when find starts the command given after the -exec primary
Riviera (which, in this case, was "rm")
Riviera it replaces the {} with the pathnames it found.
Riviera the + says to put many of them
justinko amazing
Riviera with a \; instead of a +, one rm would be started per file
justinko are you a system admin by job?
Riviera but since rm can remove more than one file at a time ... using "+" is more efficient
Riviera no, i'm not :)
Riviera i study humanities ,)
Riviera am sorry, need to leave now, quite late here :)
Riviera nite :)
justinko thank you for the help!
Riviera :)


Written by Amber Jain

November 12, 2009 at 5:13 AM

Quoting tobiasu (#openbsd at freenode IRC)

leave a comment »

Recently I was logged in to #openbsd at freenode and this conversation started:

kleanchap: Do they have OpenBSD as VM appliances?
viq: “they” ?
tcccp: The letter boys?
tcccp: πŸ˜‰
Bink: kleanchap, no
_obook: kleanchap: you can use cd46.iso for a simple net-installation
_obook: kleanchap: in a Vmware or VirtualBox VM
kleanchap: either
tobiasu: it sucks in both, forget it
tobiasu: virtualbox/vmware is the new god of IT it seems
tobiasu: everybody masturbates to their altar


Quoting tobiasu:
Virtualbox/Vmware is the new god of IT it seems. Everybody masturbates to their altar.


Written by Amber Jain

November 7, 2009 at 1:16 PM

Posted in Random rants

Tagged with , , , ,

Are you a programmer or a lawyer?

leave a comment »

Before starting, let me tell you that I’m a programmer πŸ™‚

I recently found out Thomas Pfaff’s (#openbsd nick: tp76) website. The home page reads like:

$ wc -l license/ISC license/GPL | head -2
13 ISC
674 GPL

In the end it says: “Are you a programmer or a lawyer?“. I guess I should be tagged ‘programmer’ (I always prefer ISC or BSD license). What about you?


Written by Amber Jain

October 26, 2009 at 6:33 PM