I just searched how to check if the user is root and this solution seem to be the more portable. The superuser always has id 0 but it could be named whatever, of course it almost always is named root and in this context surely is.