When you can use a different license?
To quote M. Warner Losh (with permission):
So long as there’s old code, you can’t replace the copyright, unlessthe old code that remains is not protectable by copyright any more(eg, if it is just { and } lines). If you add your own implementation of the 50 lines in question, or
move them to a separate file, then you can put your own
copyright/license statement on the code you wrote.
In conclusion:
It does matter how trivial the code is. Even the case is 50 vs 2100 (~2$), license can not be altered. However, if the only left-off is not protectable ({, } lines), then the code is completely yours so changing license is fine.
(The original question was mentioned in -developers@, but I think the information is useful so I have requested for permission to copy it here. The file was moved to 2 clause license because OpenBSD has did the change with author’s permission).