Evan Layton wrote:
> I need to get a review the following simple fix.
>
> This problem was caused by the inappropriate use of strncmp() in my
> fix for 3332. Because of the way strncmp() was being used we end up
> comparing only the length of the currently active BE name. What this
> causes is if the current BE is named say snv_108 and the BE we are
> attempting to rename is called snv_108-1 we only check the length of
> the current BE and of course it says these are the same so the rename
> fails. The fix in this case is to simply replace the strncmp() with
> strcmp().
>
> 7269 beadm rename can fail.
> http://defect.opensolaris.org/bz/show_bug.cgi?id=7269
>
> Webrev:
> http://cr.opensolaris.org/~evanl/7269/
>
> Thanks!
> -evan
> _______________________________________________
> caiman-discuss mailing list
> caiman-discuss at opensolaris.org
> http://mail.opensolaris.org/mailman/listinfo/caiman-discuss
I have a safer suggestion:
Maybe it would be safest to continue using strncmp with the length of
the longest string passed as "n" (lenght).
e.g.:
#define MAX(a, b) ((a) > (b) ? (a) : (b))
...
if (strncmp(bt.obe_name, cbt.obe_name,
MAX(strlen(bt.obe_name), strlen(cbt.obe_name))) == 0) {
...
What do you think? Would that be safer or unnecessary?
Joe