TNG 0.7 - can't join domain

Patrick J. LoPresti patl at cag.lcs.mit.edu
Tue Feb 29 20:15:42 GMT 2000


"Sander Striker" <s.striker at striker.nl> writes:

> For now, and for me personally, this is a good fix. Make sure to
> keep it all symmetric though. It's very easy to forget an
> unbecome_root() :-)

How about making an "AS_ROOT" macro which you could use like this:

  AS_ROOT {
    stuff ();
  }

I am envisioning something like this:

  #define AS_ROOT  for (int _i = 1 ; become_root(_i) ; _i = 0)

(Where become_root() takes an argument for whether to "become" or
"unbecome", and it returns its argument.)

The only problem with this macro is that it uses a C++-ism.  If you
need straight C, you could define two macros which you would use like
this:

  BECOME_ROOT
  stuff();
  UNBECOME_ROOT


  #define BECOME_ROOT  { become_root();
  #define UNBECOME_ROOT  unbecome_root(); }

This is no easier to use than the current scheme, but it will give a
compile-time error (unbalanced curlies) if you screw up.

Just a thought.

 - Pat


More information about the samba-ntdom mailing list